Summary: Optimisation with inline function causes invalid
behaviour
Product: gcc
Version: 4.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
--- 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
--- 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
--- 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