Mercurial > hg > CbC > CbC_gcc
diff gcc/testsuite/g++.target/i386/pr85334-2.C @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gcc/testsuite/g++.target/i386/pr85334-2.C Thu Feb 13 11:34:05 2020 +0900 @@ -0,0 +1,48 @@ +// { dg-do run } +// { dg-require-effective-target cet } +// { dg-additional-options "-fexceptions -fnon-call-exceptions -fcf-protection" } + +// Delta between numbers of call stacks of pr85334-1.C and pr85334-2.C is 1. + +#include <signal.h> +#include <stdlib.h> + +void sighandler (int signo, siginfo_t * si, void * uc) +{ + throw (5); +} + +char * +__attribute ((noinline, noclone)) +dosegv () +{ + * ((volatile int *)0) = 12; + return 0; +} + +int +__attribute ((noinline, noclone)) +func1 () +{ + try { + dosegv (); + } + catch (int x) { + return (x != 5); + } + return 1; +} + +int main () +{ + struct sigaction sa; + int status; + + sa.sa_sigaction = sighandler; + sa.sa_flags = SA_SIGINFO; + + status = sigaction (SIGSEGV, & sa, NULL); + status = sigaction (SIGBUS, & sa, NULL); + + return func1 (); +}