This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/51921] [4.6/4.7 regression] EH unwinding support is broken


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51921

--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-02-10 23:35:15 UTC ---
Here is a C++ example (which comes from PR 52205 which I marked as a dup of
this bug):
#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);
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]