llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: puneeth_aditya_5656 (mugiwaraluffy56)

<details>
<summary>Changes</summary>

`__alignof__` returns the "preferred" alignment, which can differ from the 
actual ABI required alignment on some architectures. This can give misleading 
results in the generated layout tests when testing ABI compatibility.

Use `_Alignof` (C11 standard keyword) instead, which returns the actual ABI 
required alignment.

Fixes #<!-- -->179007.

---
Full diff: https://github.com/llvm/llvm-project/pull/179031.diff


1 Files Affected:

- (modified) clang/utils/ABITest/ABITestGen.py (+1-1) 


``````````diff
diff --git a/clang/utils/ABITest/ABITestGen.py 
b/clang/utils/ABITest/ABITestGen.py
index 119b3299ffa60..6dcf75f69ea8b 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,
         )

``````````

</details>


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

Reply via email to