1 /* PR middle-end/17813 */
2 /* Origin: Tom Hughes <tom@compton.nu> */
3 /* { dg-do run { target i?86-*-linux* x86_64-*-linux* } } */
4 /* { dg-options "-O -fomit-frame-pointer" } */
5 /* { dg-options "-O -fomit-frame-pointer -march=i386" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
11 static jmp_buf segv_jmpbuf
;
13 static void segv_handler(int seg
)
15 __builtin_longjmp(segv_jmpbuf
, 1);
18 static int is_addressable(void *p
, size_t size
)
20 volatile char * volatile cp
= (volatile char *)p
;
22 struct sigaction sa
, origsa
;
25 sa
.sa_handler
= segv_handler
;
27 sigfillset(&sa
.sa_mask
);
28 sigaction(SIGSEGV
, &sa
, &origsa
);
29 sigprocmask(SIG_SETMASK
, NULL
, &mask
);
31 if (__builtin_setjmp(segv_jmpbuf
) == 0) {
38 sigaction(SIGSEGV
, &origsa
, NULL
);
39 sigprocmask(SIG_SETMASK
, &mask
, NULL
);
44 int main(int argc
, char **argv
)
46 is_addressable(0x0, 1);