| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fno-tree-dce -fno-tree-ccp -fno-tree-copy-prop -fno-tree-dominator-opts" } */ |
| 3 |
|
| 4 |
/* This caused the compiler to enter an infinite loop if copies are not |
| 5 |
fully propagated. The options are to disable copy propagation and |
| 6 |
thus expose the bug. */ |
| 7 |
|
| 8 |
int foo (void); |
| 9 |
|
| 10 |
struct A { |
| 11 |
struct B { |
| 12 |
struct B *n; |
| 13 |
} *p; |
| 14 |
}; |
| 15 |
|
| 16 |
static inline void baz (struct A *a) |
| 17 |
{ |
| 18 |
a->p = a->p->n; |
| 19 |
} |
| 20 |
|
| 21 |
void bar (struct A a) |
| 22 |
{ |
| 23 |
while (foo ()) |
| 24 |
baz (&a); |
| 25 |
while (foo ()); |
| 26 |
} |