[PATCH] D142327: [clang][RISCV] Fix ABI handling of empty structs with hard FP calling conventions in C++

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 24 09:01:06 PDT 2023


asb reopened this revision.
asb added a comment.
This revision is now accepted and ready to land.

Reopening as I've reverted following Roger's bug report.



================
Comment at: clang/lib/CodeGen/Targets/RISCV.cpp:178
       return false;
-    if (isEmptyRecord(getContext(), Ty, true))
+    if (isEmptyRecord(getContext(), Ty, true, true))
       return true;
----------------
rogfer01 wrote:
> I've observed (based on manually added tracing) that we may return true here with `Field1Ty == nullptr` and `Field2Ty == nullptr`.
> 
> Then `RISCVABIInfo::coerceAndExpandFPCCEligibleStruct` receives these two types and appends `Field1Ty` it into `UnpaddedCoerceElts` and then if `Field2Ty == nullptr` it calls `ABIArgInfo::getCoerceAndExpand` (around line 280 of `clang/lib/CodeGen/Targets/RISCV.cpp`) which then tries to do a `dyn_cast` on a null value and then an assertion fires (around line 256 of `clang/include/clang/CodeGen/CGFunctionInfo.h`)
> 
> I can reproduce this with the llvm-testsuite. Apologies that I have not managed to create a small reproducer yet.
Thank you, I've reverted until this can be investigated and fixed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142327



More information about the llvm-commits mailing list