| 1 |
// { dg-do compile { target c++11 } } |
| 2 |
// { dg-options "-O3" } |
| 3 |
|
| 4 |
// PR tree-optimization/118077 |
| 5 |
|
| 6 |
// This used to ICE because the devirtualization call |
| 7 |
// of bb inside f1 (which was inlined into f2) became |
| 8 |
// a direct call to c1::bb but the abnormal edge |
| 9 |
// was not removed even though bb was const. |
| 10 |
|
| 11 |
int f() __attribute__((returns_twice)); |
| 12 |
struct c1 { |
| 13 |
virtual int bb(void) const { return 0; } |
| 14 |
bool f1(int a) |
| 15 |
{ |
| 16 |
return a && !bb(); |
| 17 |
} |
| 18 |
}; |
| 19 |
struct c2 final : c1 { void f2(int); }; |
| 20 |
void c2::f2(int a) { |
| 21 |
if (!f1(a)) |
| 22 |
f(); |
| 23 |
} |