Andrew Haley <aph@xxxxxxxxxx> writes: > On 03/30/2012 08:26 PM, Ian Lance Taylor wrote: >> Oliver Kowalke <oliver.kowalke@xxxxxx> writes: >> >>> Am 30.03.2012 17:08, schrieb Ian Lance Taylor: >>>> "Oliver Kowalke"<oliver.kowalke@xxxxxx> writes: >>>> >>>>> I get a segfault with following app - could you verify this? >>>> This program works fine for me (gcc 4.4.3, glibc 2.11.1, Ubuntu Lucid) >>>> in 64-bit mode. But now I see that you are using 32-bit mode. I can >>>> confirm that the program crashes for me in that mode. >>>> >>>> Looking at the 32-bit implementation of makecontext in glibc, I can see >>>> that the problem is that it doesn't set up correct unwind information >>>> for the parameters pushed on the stack. The effect is that the first >>>> parameter on the stack appears to be a PC value. I think this is a bug >>>> in glibc. It should be possible to arrange for unwind information which >>>> skips %ebx words on the stack. >>> >>> I think the test app is not correct - on ppc32/linux it never returns. >> >> Any application that tries to walk up the stack to the end is >> unfortunately going to be tricky and non-portable. If you want a >> portable program you should always have some way to stop the stack >> unwind yourself. That is unfortunate but true. > > I'm not at all happy about that. Any system that supports backtrace() > should be able to get this right. I've had to fix more than one > system to make unwinding work right; if it doesn't, that can (and IMO > should) be treated as a bug. I suppose I can't argue with that. As seen in my message quoted above, I think there is a bug in the 32-bit x86 implementation of makecontext in glibc. I have not looked into the PPC32 case. Ian