public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/17855] New: modification of function return not diagnosed
@ 2004-10-05 23:43 rth at gcc dot gnu dot org
  2004-10-06  8:40 ` [Bug c/17855] " jsm28 at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-10-05 23:43 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2005-03-31 23:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-05 23:43 [Bug c/17855] New: modification of function return not diagnosed rth at gcc dot gnu dot org
2004-10-06  8:40 ` [Bug c/17855] " jsm28 at gcc dot gnu dot org
2004-10-06 13:31 ` [Bug c/17855] [4.0 Regression] " pinskia at gcc dot gnu dot org
2004-10-28 16:35 ` jsm28 at gcc dot gnu dot org
2005-03-30 18:06 ` [Bug c/17855] [4.0/4.1 Regression] modification of function struct " jsm28 at gcc dot gnu dot org
2005-03-30 23:07 ` jsm28 at gcc dot gnu dot org
2005-03-31 10:10 ` jsm28 at gcc dot gnu dot org
2005-03-31 22:16 ` rth at gcc dot gnu dot org
2005-03-31 23:34 ` cvs-commit at gcc dot gnu dot org
2005-03-31 23:37 ` cvs-commit at gcc dot gnu dot org
2005-03-31 23:42 ` jsm28 at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).