| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O" } */ |
| 3 |
/* { dg-require-effective-target indirect_jumps } */ |
| 4 |
|
| 5 |
#include <setjmp.h> |
| 6 |
|
| 7 |
extern void abort (void); |
| 8 |
|
| 9 |
jmp_buf buf; |
| 10 |
|
| 11 |
void raise0(void) |
| 12 |
{ |
| 13 |
__builtin_longjmp (buf, 1); |
| 14 |
} |
| 15 |
|
| 16 |
int execute(int cmd) |
| 17 |
{ |
| 18 |
int last = 0; |
| 19 |
|
| 20 |
__builtin_setjmp (buf); |
| 21 |
|
| 22 |
if (last == 0) |
| 23 |
while (1) |
| 24 |
{ |
| 25 |
last = 1; |
| 26 |
raise0 (); |
| 27 |
} |
| 28 |
|
| 29 |
if (last == 0) |
| 30 |
return 0; |
| 31 |
else |
| 32 |
return cmd; |
| 33 |
} |
| 34 |
|
| 35 |
int main(void) |
| 36 |
{ |
| 37 |
if (execute (1) == 0) |
| 38 |
abort (); |
| 39 |
|
| 40 |
return 0; |
| 41 |
} |