gcc-bugs@gcc.gnu.org
[Top] [All Lists]

[Bug c/37067] gcc creating wrong code with -O2

Subject: [Bug c/37067] gcc creating wrong code with -O2
From: "stefan dot bruens at rwth-aachen dot de"
Date: 9 Aug 2008 20:37:22 -0000

------- Comment #2 from stefan dot bruens at rwth-aachen dot de  2008-08-09 
20:37 -------
The expected output is quite clear - 69f00000 6a000000 - but output is 69f00000
0.
The loop should run 100000 times, as i does not overflow.
d_phase does overflow after 2048 steps, but this should not influence the loop.

with -O2, gcc seems to do the following:
- d_phase is the same as i*0x100000
- the block should run 0x186a0 times
- (0x186a0 * 0x100000) & 0xffffffff = 0x6a000000
- break when d_phase reaches 0x6a000000 (1696 increment steps)

with -O3 and -O1, d_phase and i get their own variables
there should be at least a warning


-- 

stefan dot bruens at rwth-aachen dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37067

<Prev in Thread] Current Thread [Next in Thread>