[clang] [RISCV] Handle empty structs/unions passing in C++ (PR #97315)
Sudharsan Veeravalli via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 7 20:50:12 PDT 2024
svs-quic wrote:
> Thanks @efriedma-quic. I tried adding a test case for it locally and see that the code produced is different for llvm and gcc: https://godbolt.org/z/vdhGbvj6W
>
> Test case:
>
> ```
> struct s12 {int x[0];};
> struct s12 test_s12(struct s12 a) {
> return a;
> }
> ```
>
> For llvm this is an empty record of size zero and so it ignores it where as gcc loads 0 into a0. Do we handle this case similar to what gcc does? Or do I add a fixme for now?
>
> @topperc @asb
What about the case I have mentioned in https://godbolt.org/z/vdhGbvj6W ?
Having a check for both Size==0 and LangOpts.CPlusPlus handles this as well.
https://github.com/llvm/llvm-project/pull/97315
More information about the cfe-commits
mailing list