This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/56512] Memory corruption when compiling code with -O on PowerPC when using setjmp/longjmp
- From: "mikpe at it dot uu.se" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 03 Mar 2013 14:43:40 +0000
- Subject: [Bug c/56512] Memory corruption when compiling code with -O on PowerPC when using setjmp/longjmp
- Auto-submitted: auto-generated
- References: <bug-56512-4@http.gcc.gnu.org/bugzilla/>
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?