[clang] [X86_32][C++] fix 0 sized struct case in vaarg. (PR #86388)

Longsheng Mou via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 12 20:09:11 PDT 2024


CoTinker wrote:

Inconsistency here is inevitable.
Such struct `SuperEmpty { struct{ int a[0];} b;}` in c++ mode can not be ignored in i386 for that c++ fields are never empty, and its TypeInfo.Width = TypeInfo.Align = 0.
https://github.com/llvm/llvm-project/blob/594989918bf9e178f3b7c5e200d700d0574f15ec/clang/lib/CodeGen/Targets/X86.cpp#L1070-L1091

And Indirect is false, so that DirectSize = DirectAlign = 0, which leads to error.
https://github.com/llvm/llvm-project/blob/594989918bf9e178f3b7c5e200d700d0574f15ec/clang/lib/CodeGen/ABIInfoImpl.cpp#L205-L230

How do I fix this? Change the classifyArgumentType or the EmiVAArg? @efriedma-quic 

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


More information about the cfe-commits mailing list