http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50678
--- Comment #29 from Iain Sandoe <iains at gcc dot gnu.org> 2011-10-15 19:33:25 UTC --- (In reply to comment #28) > > OK. well libgcc_s or libSystem contains the unwinder, depending on whether > > it's darwin9 or darwin10 (and assuming that there's no insertion caused by a > > DYLD_LIBRARY_PATH). I'll have to trawl through it in more detail. > > I'll try as well. so far, I added a little debugging code to init.c and looked at the params into __gnat_error_handler. AFAICT it looks perfectly sensible - and the "Right Thing" seems to happen with the stack area being recognized (for the probe) and the exception correctly chosen. The saved exception state seems OK (if one arranges to examine ucontext). however I've not got far through Raise_From_Signal_Handler () - if one continues from there it ends with a loop on x86-64/darwin9 and another segv on x86-64/darwin10. The thing that's itching slightly is that there is a syscall (in __gnat_error_handler ) to switch the signal stack - before the raise, and I wonder if the use of the alt sigstack is what's causing the problem. One would imagine that anything as radical as a missing reg. save/rest in eh would be spotted outside Ada ;-) I might try to cook up a simplified 'c' mimicry and see if that fails too. The generated eh_frame data is unchanged from O0-O2 .. ... the exception tables differ - but I guess that reflects code motion in the different optimizations.