Debian Codegraph @

gcc/testsuite/g++.target/i386/pr85334-2.C

raw
1 // { dg-do run }
2 // { dg-require-effective-target cet }
3 // { dg-additional-options "-fexceptions -fnon-call-exceptions -fcf-protection" }
4
5 // Delta between numbers of call stacks of pr85334-1.C and pr85334-2.C is 1.
6
7 #include <signal.h>
8 #include <stdlib.h>
9
10 void sighandler (int signo, siginfo_t * si, void * uc)
11 {
12 throw (5);
13 }
14
15 char *
16 __attribute ((noinline, noclone))
17 dosegv ()
18 {
19 * ((volatile int *)0) = 12;
20 return 0;
21 }
22
23 int
24 __attribute ((noinline, noclone))
25 func1 ()
26 {
27 try {
28 dosegv ();
29 }
30 catch (int x) {
31 return (x != 5);
32 }
33 return 1;
34 }
35
36 int main ()
37 {
38 struct sigaction sa;
39 int status;
40
41 sa.sa_sigaction = sighandler;
42 sa.sa_flags = SA_SIGINFO;
43
44 status = sigaction (SIGSEGV, & sa, NULL);
45 status = sigaction (SIGBUS, & sa, NULL);
46
47 return func1 ();
48 }