diff options
author | Martin Jambor <mjambor@suse.cz> | 2017-07-31 14:52:19 +0000 |
---|---|---|
committer | Martin Jambor <mjambor@suse.cz> | 2017-07-31 14:52:19 +0000 |
commit | 7e05bab54f745defb749670b8c84eaf513c0b214 (patch) | |
tree | 49524df297e69390449c3ef5037b2360d14c7b1a /gcc/testsuite/gcc.target/i386/naked-3.c | |
parent | 77b800ca8b1cca32db99261ade36bf5f0eafaff8 (diff) |
Merged trunk revision 250739 into the hsa branch
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/hsa@250744 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.target/i386/naked-3.c')
-rw-r--r-- | gcc/testsuite/gcc.target/i386/naked-3.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/naked-3.c b/gcc/testsuite/gcc.target/i386/naked-3.c new file mode 100644 index 00000000000..845300d6e4a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/naked-3.c @@ -0,0 +1,39 @@ +/* { dg-do run { target *-*-linux* *-*-gnu* } } */ +/* { dg-options "-O2" } */ + +#include <unistd.h> +#include <signal.h> +#include <stdlib.h> + +int data; + +/* Verify that naked function traps at the end. */ + +void +__attribute__((naked, noinline, noclone)) +naked (void) +{ + if (data == 0x12345678) + return; + asm ("ret"); +} + +void handler (int i) +{ + exit (0); +} + +int main () +{ + struct sigaction s; + + sigemptyset (&s.sa_mask); + s.sa_handler = handler; + s.sa_flags = 0; + sigaction (SIGILL, &s, NULL); + + data = 0x12345678; + naked (); + + abort (); +} |