http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50188
Bug #: 50188 Summary: Optimizer doesn't take into account, that longjmp could lead to loops, which causes illegal code transformations. Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: michael.v.zolotuk...@gmail.com Created attachment 25104 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25104 Bug reproducer. Setjmp/longjmp could form loops, like following: int i = 0; (void) setjmp (env); i++; if (i < 10) longjmp (env, 0); Optimizer removes check 'if(i<10)' and 'i++' (seemingly, as a dead code). In this example after such transformations the loop becomes infinite.