[Bug c/56512] Memory corruption when compiling code with -O on PowerPC when using setjmp/longjmp
mikpe at it dot uu.se
gcc-bugzilla@gcc.gnu.org
Sun Mar 3 14:43:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56512
--- Comment #1 from Mikael Pettersson <mikpe at it dot uu.se> 2013-03-03 14:43:40 UTC ---
This test case is full of undefined behaviour:
- you longjmp out of a frame to an older frame, and then expect to be able to
longjmp back into the younger frame; that doesn't work in general
- your counter variable isn't volatile (read the C standard on restrictions of
auto variables in functions invoking setjmp)
Your call_with_cushion() won't do what you think as the auto buffer is dead at
the point of the tailcall.
Is this a flawed attempt to implement coroutines?
More information about the Gcc-bugs
mailing list