1 /* { dg-do run { target *-*-linux* *-*-gnu* } } */ 2 /* { dg-options "-O0" } */ 3 4 #include <unistd.h> 5 #include <signal.h> 6 #include <stdlib.h> 7 8 /* Verify that naked function traps at the end. */ 9 10 void 11 __attribute__((naked, noinline, noclone)) 12 #ifdef __i386__ 13 __attribute__((regparm(1))) 14 #endif naked(int data)15naked (int data) 16 { 17 if (data == 0x12345678) 18 return; 19 asm ("ret"); 20 } 21 handler(int i)22void handler (int i) 23 { 24 exit (0); 25 } 26 main()27int main () 28 { 29 struct sigaction s; 30 31 sigemptyset (&s.sa_mask); 32 s.sa_handler = handler; 33 s.sa_flags = 0; 34 sigaction (SIGILL, &s, NULL); 35 36 naked (0x12345678); 37 38 abort (); 39 } 40