[PATCH] D142327: [clang][RISCV] Fix ABI handling of empty structs with hard FP calling conventions in C++
Roger Ferrer Ibanez via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 24 08:53:34 PDT 2023
rogfer01 added inline comments.
================
Comment at: clang/lib/CodeGen/Targets/RISCV.cpp:178
return false;
- if (isEmptyRecord(getContext(), Ty, true))
+ if (isEmptyRecord(getContext(), Ty, true, true))
return true;
----------------
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.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142327/new/
https://reviews.llvm.org/D142327
More information about the cfe-commits
mailing list