--- Comment #7 from pinskia at gcc dot gnu dot org 2009-01-21 23:30 ---
Yes it is a dup, replacing ++ with +=1 allows this to work correctly.
*** This bug has been marked as a duplicate of 35634 ***
--
pinskia at gcc dot gnu dot org changed:
What|Removed
--- Comment #6 from pinskia at gcc dot gnu dot org 2009-01-21 23:28 ---
Reopening to ...
--
pinskia at gcc dot gnu dot org changed:
What|Removed |Added
Status
--- Comment #5 from joseph at codesourcery dot com 2009-01-21 23:27 ---
Subject: Re: Optimisation with inline function causes invalid
behaviour
On Wed, 21 Jan 2009, rguenth at gcc dot gnu dot org wrote:
> You overflow x and y in main() which invokes undefined behavior.
Actually, I d
--- Comment #4 from rguenth at gcc dot gnu dot org 2009-01-21 20:26 ---
You overflow x and y in main() which invokes undefined behavior.
--
rguenth at gcc dot gnu dot org changed:
What|Removed |Added
--- Comment #3 from gcc at twistedsquare dot com 2009-01-21 17:36 ---
The main optimisation that seems to affect this example, is, -fstrict-overflow.
So to reiterate:
Works: gcc gccbug.c -std=gnu99 -O1
Doesn't work: gcc gccbug.c -std=gnu99 -O2
Doesn't work: gcc gccbug.c -std=gnu99 -O2
--- Comment #2 from gcc at twistedsquare dot com 2009-01-21 17:13 ---
The -fno-tree-vrp flag does stop the problem on the testcase I submitted.
However, on the full program I drew the testcase from, it only modifies the
behaviour to a different invalid problem, so it is perhaps an inter
--- Comment #1 from gcc at twistedsquare dot com 2009-01-21 17:03 ---
I tried fiddling with various optimisations. With -O1 the code works fine.
With -O2 the code breaks. With -O2 -fno-tree-vrp it works fine again, so that
may help in finding the bug.
--
http://gcc.gnu.org/bugzil