This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/59711] ICE in force_constant_size, at gimplify.c:619 with variably-modified return type
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 08 Jan 2014 11:59:12 +0000
- Subject: [Bug middle-end/59711] ICE in force_constant_size, at gimplify.c:619 with variably-modified return type
- Auto-submitted: auto-generated
- References: <bug-59711-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59711
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
int f(int n)
{
struct S {
int a[n];
};
struct S g(void)
{
struct S s;
s.a[0] = 0;
return s;
}
return g ().a[0];
}
I believe this isn't fixable with the GIMPLE IL as-is - without lowering
to the fact that g () returns by storing to a return slot. Not sure why
3.4 ICEd (2.95.2 also ICEs btw ...).
Well, maybe we can fix it if we allow creating of a variable-size temporary
during gimplification. That is, the gimple code needs to look like
tem = WITH_SIZE_EXPR <g (), sizeof (S)>;
return tem.a[0];
which of course then has the issue that we can't have WITH_SIZE_EXPR around
calls. Thus really the only way is to lower the return slot fact early.
g (&tem);
return tem.a[0];
Eventually not that way but using a special slot on the call stmt similar
to the chain / fn pointer. Enlarges all call stmts, of course.