[Bug c/38929] Optimisation with inline function causes invalid behaviour
gcc at twistedsquare dot com
gcc-bugzilla@gcc.gnu.org
Wed Jan 21 17:36:00 GMT 2009
------- 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
More information about the Gcc-bugs
mailing list