[clang] [ARM, AArch64] Fix passing of structures with aligned base classes (PR #135564)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 14 11:58:33 PDT 2025


================
@@ -1302,6 +1302,7 @@ ItaniumRecordLayoutBuilder::LayoutBase(const BaseSubobjectInfo *Base) {
     setSize(std::max(getSize(), Offset + Layout.getSize()));
 
   // Remember max struct/class alignment.
+  UnadjustedAlignment = std::max(UnadjustedAlignment, PreferredBaseAlign);
----------------
efriedma-quic wrote:

Are we supposed to use the alignment of the base class, or the natural alignment of the base class?  I'd like to see testcases for both, and information about how gcc and msvc interpret that question.

Maybe also open a bug report at https://github.com/ARM-software/abi-aa/issues for a spec clarification; Arm is usually pretty responsive there.

------

I would also ask if you want BaseAlign vs. PreferredBaseAlign here, but as far as I can tell, they should be the same on AArch64.

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


More information about the cfe-commits mailing list