[Bug tree-optimization/56982] [4.8 Regression] Bad optimization with setjmp()
bernd.edlinger at hotmail dot de
gcc-bugzilla@gcc.gnu.org
Wed Jul 3 08:05:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56982
--- Comment #15 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
(In reply to Mikael Pettersson from comment #14)
> Your example is invalid C. Referring to WG14 n1494.pdf (there may be more
> recent C1x documents, but it's the one I had available right now):
>
> - you violate 7.13.1.1 which specifies where setjmp() may be called, an
> assignment statement is not one of the permitted contexts
>
> - more importantly, your auto variable a is not volatile-qualified, which
> means that its value is indeterminate after the longjmp (7.13.2.1).
>
> Please fix these issues and check again if it yields wrong results.
Thanks for pointing that out.
When I add volatile to the auto variable, the code is OK.
More information about the Gcc-bugs
mailing list