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

via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 24 05:15:47 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.
----------------
hstk30-hw wrote:

https://github.com/llvm/llvm-project/commit/9bb857a4f1aec1c33d599672defb46b98d792719#diff-d5392fbd34fbb607cc468738adce16985f9461c9a3f5bc7c5ed64dba44137d19R3752 This is I can found when  the `i8` was introduced. Guess @TNorthover know it.

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


More information about the cfe-commits mailing list