struct C { int a; int *b; int *c1 (int x) { return new int[sizeof (int) * x]; } void c2 (int *x, int *y, int z) { for (int i = 0; i < z; i++) y[i] = x[i]; } C (int x = 0) : a (x) { if (a) { b = c1 (a); for (int i = 0; i < a; i++) b[i] = 0; } } C (const C & x) : a (x.a) { if (a) { b = c1 (a); c2 (x.b, b, a); } } ~C (void) { if (a) delete b; } int &operator [] (int x) { if (a == 0 && x == 0) { a = 1; b = c1 (1); b[0] = 0; } else { C e (*this); a = x + 1; b = c1 (a); c2 (e.b, b, e.a); for (int i = e.a; i < a; i++) b[i] = 0; } return b[x]; } C & operator << (int x) { (*this)[a] = x; return *this; } };
int bar (void) { C a; int f = 1; while (f != -1) { f = 0; a << 1; } return 0; } ICEs at -O2 in coalesce_abnormal_edges. The bug is not present on HEAD and 3.4.x compiles it just fine as well. -- Summary: ICE in coalesce_abnormal_edges Product: gcc Version: 4.0.2 Status: UNCONFIRMED Severity: normal Priority: P2 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jakub at redhat dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22415