This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/56512] Memory corruption when compiling code with -O on PowerPC when using setjmp/longjmp


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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]