1// { dg-do run { target { *-*-aix5* i?86-*-linux* i?86-*-gnu* x86_64-*-linux* } } }
2// { dg-options "-fexceptions -fnon-call-exceptions" }
3
4#include <signal.h>
5#include <stdlib.h>
6
7void sighandler (int signo, siginfo_t * si, void * uc)
8{
9  throw (5);
10}
11
12char * dosegv ()
13{
14  * ((volatile int *)0) = 12;
15}
16
17int main ()
18{
19  struct sigaction sa;
20  int status;
21
22  sa.sa_sigaction = sighandler;
23  sa.sa_flags = SA_SIGINFO;
24
25  status = sigaction (SIGSEGV, & sa, NULL);
26  status = sigaction (SIGBUS, & sa, NULL);
27
28  try {
29    dosegv ();
30  }
31  catch (int x) {
32    return (x != 5);
33  }
34
35  return 1;
36}
37
38
39