[PATCH] D131677: [clang][RISCV] Fix incorrect ABI lowering for inherited structs under hard-float ABIs

Craig Topper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 11 11:35:22 PDT 2022


craig.topper added inline comments.


================
Comment at: clang/lib/CodeGen/TargetInfo.cpp:10986
+        bool Ret = detectFPCCEligibleStructHelper(
+            B.getType(), CurOff, Field1Ty, Field1Off, Field2Ty, Field2Off);
+        if (!Ret)
----------------
jrtc27 wrote:
> jrtc27 wrote:
> > With multiple inheritance this offset won't make sense, and it gets particularly fun with diamond virtual inheritance. This is a minefield.
> > 
> > And what about non-standard layout classes in general, like the simple ones that just have a vtable, not just ones that have virtual inheritance somwhere?
> (you at least need `uint64_t BaseOffInBits = Layout.getBaseClassOffset(&B)` and to add `getContext().toCharUnitsFromBits(BaseOffInBits)` like the field case, then there's the question of non-standard layout classes)
If it has a vtable wouldn't it have failed the `getRecordArgABI` check earlier? I think the copy constructor would not be trivial in that case.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131677/new/

https://reviews.llvm.org/D131677



More information about the cfe-commits mailing list