145
|
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 func2 ()
|
|
26 {
|
|
27 try {
|
|
28 dosegv ();
|
|
29 }
|
|
30 catch (int x) {
|
|
31 return (x != 5);
|
|
32 }
|
|
33 return 1;
|
|
34 }
|
|
35
|
|
36 int
|
|
37 __attribute ((noinline, noclone))
|
|
38 func1 ()
|
|
39 {
|
|
40 return func2 ();
|
|
41 }
|
|
42
|
|
43 int main ()
|
|
44 {
|
|
45 struct sigaction sa;
|
|
46 int status;
|
|
47
|
|
48 sa.sa_sigaction = sighandler;
|
|
49 sa.sa_flags = SA_SIGINFO;
|
|
50
|
|
51 status = sigaction (SIGSEGV, & sa, NULL);
|
|
52 status = sigaction (SIGBUS, & sa, NULL);
|
|
53
|
|
54 return func1 ();
|
|
55 }
|