[clang] fix: compatible C++ empty record with align UB with gcc (PR #72197)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 15 11:33:06 PST 2023


================
@@ -65,3 +65,9 @@ EXTERNC struct SortOfEmpty sort_of_empty_ret(void) {
   struct SortOfEmpty e;
   return e;
 }
+
+// CHECK-GNU-CXX: define{{.*}} i32 @empty_align_arg(i128 %a.coerce, i32 noundef %b)
+struct EmptyAlign { long long int __attribute__((aligned)) : 0; };
----------------
AaronBallman wrote:

You should also have test coverage for an empty aligned structure (not just an alignment on a zero-width bit-field, which I'm still not certain what that actually means or why we shouldn't reject that code).

https://github.com/llvm/llvm-project/pull/72197


More information about the cfe-commits mailing list