[clang] [ARM, AArch64] Fix ABI bugs with over-sized bitfields (PR #126774)
John Brawn via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 20 05:05:35 PST 2025
================
@@ -161,5 +168,62 @@ int test_bitint8(){
}
// CHECK: ret i32 1
+// Over-sized bitfield, which results in a 64-bit container type, so 64-bit
+// alignment.
+struct OverSizedBitfield {
+ int x : 64;
+};
+
+unsigned sizeof_OverSizedBitfield = sizeof(OverSizedBitfield);
+unsigned alignof_OverSizedBitfield = alignof(OverSizedBitfield);
+
+// CHECK: define{{.*}} void @g7
+// CHECK: call void @f7(i32 noundef 1, i64 42)
+// CHECK: declare void @f7(i32 noundef, i64)
+void f7(int a, OverSizedBitfield b);
+void g7() {
+ OverSizedBitfield s = {42};
+ f7(1, s);
+}
+
+// There are no 128-bit fundamental data types defined by AAPCS32, so this gets
+// a 64-bit container plus 64 bits of padding, giving it a size of 16 bytes and
+// alignment of 8 bytes.
----------------
john-brawn-arm wrote:
It looks like you've copy-pasted this comment and it's not correct here (we expect a 128-bit container).
https://github.com/llvm/llvm-project/pull/126774
More information about the cfe-commits
mailing list