[Bug tree-optimization/56982] [4.8 Regression] Bad optimization with setjmp()
bernd.edlinger at hotmail dot de
gcc-bugzilla@gcc.gnu.org
Tue Jul 2 22:26:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56982
--- Comment #13 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
Created attachment 30431
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30431&action=edit
another example of wrong compilation
This is another example where the optimization can
go wrong.
The attached program produces expected results if
compiled with -O0:
x=0, a=1
x=1, a=1
a=1
But if compiled with -O3 and if the value "a" is placed
in a register the result is like this:
x=0, a=1
x=1, a=0
a=0
That is because longjmp has more semantic than just a branch:
It branches to the setjmp, and restores all callee saved registers to
the previos value.
More information about the Gcc-bugs
mailing list