public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/52205] New: SPARC Solaris 2.11 unwind through signal handler fails with -fnon-call-exceptions
@ 2012-02-10 23:32 ian at airs dot com
  2012-02-10 23:37 ` [Bug target/52205] " pinskia at gcc dot gnu.org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: ian at airs dot com @ 2012-02-10 23:32 UTC (permalink / raw)
  To: gcc-bugs

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: unassigned@gcc.gnu.org
        ReportedBy: ian@airs.com
                CC: ro@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.


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2012-05-26 14:02 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-10 23:32 [Bug target/52205] New: SPARC Solaris 2.11 unwind through signal handler fails with -fnon-call-exceptions ian at airs dot com
2012-02-10 23:37 ` [Bug target/52205] " pinskia at gcc dot gnu.org
2012-02-11 10:48 ` ebotcazou at gcc dot gnu.org
2012-02-12  4:13 ` ian at airs dot com
2012-02-12 10:07 ` ebotcazou at gcc dot gnu.org
2012-02-12 15:33 ` ebotcazou at gcc dot gnu.org
2012-02-12 19:53 ` ian at airs dot com
2012-02-12 20:25 ` ebotcazou at gcc dot gnu.org
2012-02-14 18:39 ` [Bug target/52205] unwinding through signal handler fails ro at CeBiTec dot Uni-Bielefeld.DE
2012-02-14 22:05 ` ebotcazou at gcc dot gnu.org
2012-02-15  8:15 ` ebotcazou at gcc dot gnu.org
2012-02-15  8:17 ` ebotcazou at gcc dot gnu.org
2012-02-15  8:22 ` ebotcazou at gcc dot gnu.org
2012-02-16 19:54 ` ro at CeBiTec dot Uni-Bielefeld.DE
2012-05-26 13:56 ` ebotcazou at gcc dot gnu.org
2012-05-26 14:12 ` ebotcazou at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).