Fortran: Fix PR 47485.
[gcc.git] / gcc / testsuite / g++.dg / torture / except-1.C
blob7050a33cc273ed43f4a51fe3fe67d8fe819e7fba
1 // { dg-do run { target { i?86-*-linux* i?86-*-gnu* x86_64-*-linux* } } }
2 // { dg-additional-options "-fexceptions -fnon-call-exceptions -fno-delete-dead-exceptions" }
4 #include <signal.h>
5 #include <stdlib.h>
6 #include <string.h>
8 static void
9 sighandler (int signo, siginfo_t* si, void* uc)
11   throw (5);
14 struct S { void *p1, *p2; };
16 struct S v;
18 __attribute__ ((noinline))
19 int
20 dosegv ()
22   struct S *p = 0;
23   struct S s __attribute__((unused)) = *p;
24   return 0;
27 int main ()
29   struct sigaction sa;
31   memset (&sa, 0, sizeof sa);
32   sa.sa_sigaction = sighandler;
33   sigaction (SIGSEGV, &sa, NULL);
34   sigaction (SIGBUS, &sa, NULL);
36   try {
37     dosegv ();
38   }
39   catch (int x) {
40     return (x != 5);
41   }
43   return 1;