| 1 |
/* PR rtl-optimization/51447 */ |
| 2 |
/* { dg-require-effective-target label_values } */ |
| 3 |
/* { dg-require-effective-target indirect_jumps } */ |
| 4 |
|
| 5 |
extern void abort (void); |
| 6 |
|
| 7 |
#ifdef __x86_64__ |
| 8 |
register void *ptr asm ("rbx"); |
| 9 |
#else |
| 10 |
void *ptr; |
| 11 |
#endif |
| 12 |
|
| 13 |
int |
| 14 |
main (void) |
| 15 |
{ |
| 16 |
__label__ nonlocal_lab; |
| 17 |
#ifdef __x86_64__ |
| 18 |
void *save = ptr; |
| 19 |
#endif |
| 20 |
__attribute__((noinline, noclone)) void |
| 21 |
bar (void *func) |
| 22 |
{ |
| 23 |
ptr = func; |
| 24 |
goto nonlocal_lab; |
| 25 |
} |
| 26 |
bar (&&nonlocal_lab); |
| 27 |
return 1; |
| 28 |
nonlocal_lab: |
| 29 |
if (ptr != &&nonlocal_lab) |
| 30 |
abort (); |
| 31 |
#ifdef __x86_64__ |
| 32 |
ptr = save; /* Restore the call-saved register. */ |
| 33 |
#endif |
| 34 |
return 0; |
| 35 |
} |