https://github.com/mugiwaraluffy56 updated 
https://github.com/llvm/llvm-project/pull/179031

>From 2790ecd3e25f22275c1c71fbefc022379d314621 Mon Sep 17 00:00:00 2001
From: mugiwaraluffy56 <[email protected]>
Date: Sat, 31 Jan 2026 18:19:42 +0530
Subject: [PATCH] [ABITest] Use _Alignof instead of __alignof__ for ABI
 alignment

__alignof__ returns the 'preferred' alignment which may differ from
the actual ABI-required alignment on some architectures. This can
give misleading results in generated layout tests.

Use _Alignof (C11 standard) instead, which returns the actual
ABI-required alignment of a type.

Fixes #179007.
---
 clang/utils/ABITest/ABITestGen.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/utils/ABITest/ABITestGen.py 
b/clang/utils/ABITest/ABITestGen.py
index 119b3299ffa60..6770ef2a9bf87 100755
--- a/clang/utils/ABITest/ABITestGen.py
+++ b/clang/utils/ABITest/ABITestGen.py
@@ -306,7 +306,7 @@ def printSizeOfType(self, prefix, name, t, output=None, 
indent=2):
 
     def printAlignOfType(self, prefix, name, t, output=None, indent=2):
         print(
-            '%*sprintf("%s: __alignof__(%s) = %%ld\\n", 
(long)__alignof__(%s));'
+            '%*sprintf("%s: _Alignof(%s) = %%ld\\n", (long)_Alignof(%s));'
             % (indent, "", prefix, name, name),
             file=output,
         )

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to