Bug 6891 - G++ generates incorrect code when -Os is used
Summary: G++ generates incorrect code when -Os is used
Status: RESOLVED DUPLICATE of bug 11751
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 3.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Keywords: wrong-code
Depends on:
Reported: 2002-05-31 18:46 UTC by av1474
Modified: 2005-11-10 03:49 UTC (History)
44 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description av1474 2002-05-31 18:46:02 UTC
G++ emits wrong code for following fragment:
char * p = name; while (*p) *p++ = (char)tolower (*p);
when invoked like this:
gcc -Os moo.cpp

gcc version 3.1

Linux 2.4.16 i686 unknown

Get http://algol.prosalg.no/~malc/okasankaar-pl1.zip and observe (make CC=g++ is needed for 3.1)
Comment 1 Eric Botcazou 2003-02-19 10:06:14 UTC
State-Changed-From-To: open->closed
State-Changed-Why: Not a bug. The C++ standard doesn't guarantee the order of evaluation
    in the assignment-with-side-effects expression.
Comment 2 Andrew Pinski 2005-11-10 03:49:27 UTC
Reopening to ...
Comment 3 Andrew Pinski 2005-11-10 03:49:41 UTC
Mark as a dup of bug 11751.

*** This bug has been marked as a duplicate of 11751 ***