Closed hikari-no-yume closed 2 years ago
Example of the problem:
$ cc ../testfiles/byval-simpler.cbe.c
../testfiles/byval-simpler.cbe.c:49:14: error: member reference type 'struct
l_struct_struct_OC_intbox' is not a pointer; did you mean to use '.'?
_4 = *((&_1->field0));
~~^~
.
../testfiles/byval-simpler.cbe.c:49:11: error: cannot take the address of an
rvalue of type 'uint32_t' (aka 'unsigned int')
_4 = *((&_1->field0));
^~~~~~~~~~~
../testfiles/byval-simpler.cbe.c:50:14: error: member reference type 'struct
l_struct_struct_OC_intbox' is not a pointer; did you mean to use '.'?
_5 = *((&_2->field0));
~~^~
.
../testfiles/byval-simpler.cbe.c:50:11: error: cannot take the address of an
rvalue of type 'uint32_t' (aka 'unsigned int')
_5 = *((&_2->field0));
^~~~~~~~~~~
4 errors generated.
(This is the test included in the patch.)
This must have regressed at some point, because the existence of
ByValParams
suggests there used to be handling of it.The problem is that if you have a
byval
struct argument (produced for e.g.void foo(some_large_struct bar)
) then it's a pointer type in LLVM, but in C it's a by-value struct argument, so we need to add&
in front of it.