Debian Codegraph @

gcc/testsuite/g++.dg/eh/sighandle.C

raw
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
7 void sighandler (int signo, siginfo_t * si, void * uc)
8 {
9 throw (5);
10 }
11
12 char * dosegv ()
13 {
14 * ((volatile int *)0) = 12;
15 return 0;
16 }
17
18 int main ()
19 {
20 struct sigaction sa;
21 int status;
22
23 sa.sa_sigaction = sighandler;
24 sa.sa_flags = SA_SIGINFO;
25
26 status = sigaction (SIGSEGV, & sa, NULL);
27 status = sigaction (SIGBUS, & sa, NULL);
28
29 try {
30 dosegv ();
31 }
32 catch (int x) {
33 return (x != 5);
34 }
35
36 return 1;
37 }
38
39