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