| 1 |
/* { dg-require-effective-target indirect_jumps } */ |
| 2 |
#include <setjmp.h> |
| 3 |
|
| 4 |
extern void abort (void); |
| 5 |
extern void exit (int); |
| 6 |
|
| 7 |
static jmp_buf env; |
| 8 |
|
| 9 |
void baz (void) |
| 10 |
{ |
| 11 |
__asm__ volatile ("" : : : "memory"); |
| 12 |
} |
| 13 |
|
| 14 |
static inline int g(int x) |
| 15 |
{ |
| 16 |
if (x) |
| 17 |
{ |
| 18 |
baz(); |
| 19 |
return 0; |
| 20 |
} |
| 21 |
else |
| 22 |
{ |
| 23 |
baz(); |
| 24 |
return 1; |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
int f(int *e) |
| 29 |
{ |
| 30 |
if (*e) |
| 31 |
return 1; |
| 32 |
|
| 33 |
int x = setjmp(env); |
| 34 |
int n = g(x); |
| 35 |
if (n == 0) |
| 36 |
exit(0); |
| 37 |
if (x) |
| 38 |
abort(); |
| 39 |
longjmp(env, 42); |
| 40 |
} |
| 41 |
|
| 42 |
int main(int argc, char** argv) |
| 43 |
{ |
| 44 |
int v = 0; |
| 45 |
return f(&v); |
| 46 |
} |