| 1 |
// PR rtl-optimization/36419 |
| 2 |
// { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } |
| 3 |
// { dg-options "-Os -fasynchronous-unwind-tables -mpreferred-stack-boundary=4" } |
| 4 |
|
| 5 |
extern "C" void abort (); |
| 6 |
|
| 7 |
int v = -1; |
| 8 |
unsigned int n; |
| 9 |
|
| 10 |
__attribute__((noinline, used)) |
| 11 |
void foo (int a, int) |
| 12 |
{ |
| 13 |
if (v < 0) |
| 14 |
v = ((unsigned long) &a) & 15; |
| 15 |
else if ((((unsigned long) &a) & 15) != v) |
| 16 |
abort (); |
| 17 |
if (n++ == 0) |
| 18 |
throw 1; |
| 19 |
} |
| 20 |
|
| 21 |
__attribute__((noinline, used)) |
| 22 |
void baz (int a, int, int, int, int, int, int) |
| 23 |
{ |
| 24 |
if (v < 0) |
| 25 |
v = ((unsigned long) &a) & 15; |
| 26 |
else if ((((unsigned long) &a) & 15) != v) |
| 27 |
abort (); |
| 28 |
if (n++ == 0) |
| 29 |
throw 1; |
| 30 |
} |
| 31 |
|
| 32 |
struct A { A () { }; ~A (); char c[24]; }; |
| 33 |
|
| 34 |
__attribute__((noinline)) |
| 35 |
A::~A () |
| 36 |
{ |
| 37 |
asm volatile ("" : : : "memory"); |
| 38 |
} |
| 39 |
|
| 40 |
__attribute__((noinline)) |
| 41 |
void bar () |
| 42 |
{ |
| 43 |
A a; |
| 44 |
try |
| 45 |
{ |
| 46 |
foo (1, 2); |
| 47 |
baz (3, 4, 5, 6, 7, 8, 9); |
| 48 |
} |
| 49 |
catch (...) |
| 50 |
{ |
| 51 |
} |
| 52 |
foo (1, 2); |
| 53 |
baz (3, 4, 5, 6, 7, 8, 9); |
| 54 |
} |
| 55 |
|
| 56 |
int |
| 57 |
main () |
| 58 |
{ |
| 59 |
bar (); |
| 60 |
return 0; |
| 61 |
} |