Bug 6891

Summary: G++ generates incorrect code when -Os is used
Product: gcc Reporter: av1474
Component: rtl-optimizationAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED DUPLICATE    
Severity: normal CC: algorithmus, arminu, asokumar, av1474, bala, barnarr, bmead15, buergel, carpman, ceniza666, chuchunxin, devnull, d_picco, ebotcazou, eric.mcvicker, gaurav_har, gcc-bugs, gcc, ggs, horsh, jandres, janis, jompo, krs, lid, lindahlb, lxg8906, mikaldaz, nakkore, pierre.van.de.laar_at_philips.com, qyang, raoulgough, rglan, rjvbertin, robc, s9322036, smartmouse714, suan, super.aorta, svetozarmarkov, tczarnecki, vanveghel, work, zshao
Priority: P3 Keywords: wrong-code
Version: 3.1   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:

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

Release:
gcc version 3.1

Environment:
Linux 2.4.16 i686 unknown

How-To-Repeat:
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 ***