[Bug c/17855] New: modification of function return not diagnosed
rth at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Tue Oct 5 23:43:00 GMT 2004
struct foo {char x, y, z[2];};
struct foo f();
void bar(int baz)
{
f().z[baz] = 1;
}
Generates
z.c:5: internal compiler error: gimplification failed
But I don't see that this is legal according to [6.5.2.2]/5
# If an attempt is made to modify the result of a function
# call ... behaviour is undefined.
If we must accept this construct because it might not be
executed, a possible solution is to notice fallback==fb_lvalue
for a CALL_EXPR in c_gimplify_expr and create a temporary for
the call result, and which will also satisfy the lvalue.
This test has crashed in all versions since at least 2.96.
--
Summary: modification of function return not diagnosed
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rth at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17855
More information about the Gcc-bugs
mailing list