[Bug middle-end/92088] aggregates with VLAs and nested functions are broken
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Oct 15 13:19:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92088
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Created attachment 47041
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47041&action=edit
patch for the inliner
void foo(int n)
{
struct X { int a[n]; } y;
inline struct X __attribute__((always_inline)) baz (struct X x)
{
x.a[0] = 1;
return x;
}
y.a[0] = 0;
y = baz(y);
if (y.a[0] != 1)
__builtin_abort ();
}
doesn't require any other middle-end fixes but straight runs into the inliner
deficiency. Note that we don't use DECL_BY_REFERENCE here so the ABI for
passing this might be a bit odd (or not properly defined at all - we're
dealing with nested functions anyway).
Anyhow - attached is a patc^Whack for the inliner. We then inline this as
struct X xD.1985 [value-expr: *_52];
...
_52 = __builtin_alloca_with_align (_48, 32);
_53 = __builtin_memcpy (_52, y.1_46, _48);
but we obviously lack building a stack_save/restore pair around inlinings
of alloca-calling functions (or such param setup).
More information about the Gcc-bugs
mailing list