This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/38929] Optimisation with inline function causes invalid behaviour
- From: "gcc at twistedsquare dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Jan 2009 17:36:10 -0000
- Subject: [Bug c/38929] Optimisation with inline function causes invalid behaviour
- References: <bug-38929-17214@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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 -fno-strict-overflow
Works: gcc gccbug.c -O2 -std=gnu99 -O2 -fno-strict-overflow -fno-tree-vrp
I can see that the assumptions involved in strict-overflow may cause the
overflow test to behave differently, but it is still the case that under the
optimisations, one printf says -128 for the int8_t value, and the other (when
passed in the same value from a different call) says 128, and therefore I am
still confident that this is a bug.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38929