http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52205
Bug #: 52205 Summary: SPARC Solaris 2.11 unwind through signal handler fails with -fnon-call-exceptions Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: i...@airs.com CC: r...@gcc.gnu.org Compile this C++ program with -fnon-call-exceptions: #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> void die(const char* msg) { perror(msg); exit(EXIT_FAILURE); } void handler(int signo, siginfo_t* info, void *context) { printf("in handler signal %d\n", signo); throw signo; } int main(int, const char**) { struct sigaction act; memset(&act, 0, sizeof act); act.sa_sigaction = handler; sigfillset(&act.sa_mask); act.sa_flags = SA_SIGINFO; if (sigaction(SIGSEGV, &act, NULL) != 0) die("sigaction"); try { *reinterpret_cast<char*>(0) = 1; } catch (int signo) { printf("caught signal %d\n", signo); exit(EXIT_SUCCESS); } printf("did not catch\n"); exit(EXIT_FAILURE); } When this program is run, it should print something like in handler signal 11 caught signal 11 This works fine on GNU/Linux and on x86 and x86_64 Solaris 2.11. When run on SPARC Solaris 2.11, however, it prints in handler signal 11 Segmentation Fault I see this in both 32-bit and 64-bit mode. If I tweak libgcc/config/sparc/sol2-unwind.h so that sparc_is_sighandler sets *nframes to 3 rather than 2, then the test passes (I only tried this in 32-bit mode, not in 64-bit mode). The cuh_pattern test in sparc_is_sighandler does not match, so presumably it needs to be adjusted for Solaris 2.11. However, I'm not sure how to properly and safely correct it.