| 1 |
// PR target/30230 |
| 2 |
// This testcase failed on IA-64, where end of an EH region ended |
| 3 |
// in the middle of a bundle (with br.call insn in first or second |
| 4 |
// slot of .bbb/.mbb bundles and EH region end right after it). |
| 5 |
// But br.call returns to the start of the next bundlem so during |
| 6 |
// unwinding the call was considered to be outside of the EH region |
| 7 |
// while it should have been inside. |
| 8 |
// { dg-do run } |
| 9 |
// { dg-require-weak "" } |
| 10 |
// { dg-options "-O2" } |
| 11 |
|
| 12 |
struct A {}; |
| 13 |
struct B { virtual ~B(); }; |
| 14 |
B::~B () {} |
| 15 |
struct C { void foo (short &, B &); }; |
| 16 |
struct D { void *d1; C *d2; virtual void virt (void) {} }; |
| 17 |
struct E { D *e1; B *e2; }; |
| 18 |
struct F { void bar (void *, B &); }; |
| 19 |
F *p __attribute__((weak)); |
| 20 |
volatile int r; |
| 21 |
|
| 22 |
void C::foo (short &x, B &) |
| 23 |
{ |
| 24 |
if (r) |
| 25 |
throw A (); |
| 26 |
x = 1; |
| 27 |
} |
| 28 |
|
| 29 |
void F::bar (void *, B &) |
| 30 |
{ |
| 31 |
throw A (); |
| 32 |
} |
| 33 |
|
| 34 |
void baz (E &x) |
| 35 |
{ |
| 36 |
short g = 0; |
| 37 |
B b = *x.e2; |
| 38 |
x.e1->d2->foo (g, b); |
| 39 |
if (g) |
| 40 |
p->bar(x.e1->d1, b); |
| 41 |
} |
| 42 |
|
| 43 |
int main () |
| 44 |
{ |
| 45 |
F g; |
| 46 |
D s; |
| 47 |
E h; |
| 48 |
p = &g; |
| 49 |
h.e1 = &s; |
| 50 |
try |
| 51 |
{ |
| 52 |
baz (h); |
| 53 |
} |
| 54 |
catch (A &) |
| 55 |
{ |
| 56 |
} |
| 57 |
return 0; |
| 58 |
} |