[clang] fix: C++ empty record with align lead to va_list out of sync (PR #72197)

John McCall via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 23 12:54:10 PST 2023


================
@@ -307,7 +307,12 @@ AArch64ABIInfo::classifyArgumentType(QualType Ty, bool IsVariadic,
     // 0.
     if (IsEmpty && Size == 0)
       return ABIArgInfo::getIgnore();
-    return ABIArgInfo::getDirect(llvm::Type::getInt8Ty(getVMContext()));
+    // An empty struct can have size greater than one byte if alignment is
+    // involved.
+    // When size <= 64, we still hold it by i8 in IR and lowering to registers.
+    // When Size > 64, just fall through to avoid va_list out of sync.
----------------
rjmccall wrote:

Yes, I intended that as a suggestion for the comment, and you're welcome to include it verbatim.

I agree with Eli that I'd like to understand why we need to have this `i8` carve-out.

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


More information about the cfe-commits mailing list