| 1 |
// PR c++/81438 |
| 2 |
// { dg-do compile { target indirect_jumps } } |
| 3 |
// { dg-options "" } |
| 4 |
|
| 5 |
bool b; |
| 6 |
int main() |
| 7 |
{ |
| 8 |
try |
| 9 |
{ |
| 10 |
try { throw 3; } |
| 11 |
catch(...) { |
| 12 |
h:; // { dg-warning "jump to label" } |
| 13 |
try { throw 7; } |
| 14 |
catch(...) { |
| 15 |
if (b) |
| 16 |
goto *&&h; // { dg-message "computed goto" } |
| 17 |
// { dg-message "handled exception" "" { target *-*-* } .-1 } |
| 18 |
else |
| 19 |
goto *&&g; // { dg-message "computed goto" } |
| 20 |
// { dg-message "handled exception" "" { target *-*-* } .-1 } |
| 21 |
} |
| 22 |
g:; // { dg-warning "jump to label" } |
| 23 |
throw; |
| 24 |
} |
| 25 |
} |
| 26 |
catch(int v) |
| 27 |
{ |
| 28 |
__builtin_printf("%d\n", v); |
| 29 |
if(v != 3) // 7 because we don't clean up the catch on |
| 30 |
__builtin_abort(); // computed goto |
| 31 |
} |
| 32 |
|
| 33 |
return 0; |
| 34 |
} |