+2003-10-06 Eric Botcazou <ebotcazou@libertysurf.fr>
+
+ PR optimization/12215
+ * cse.c (cse_set_around_loop): Emit the move at the beginning
+ of the next basic block for trapping sets.
+
2003-10-06 Eric Botcazou <ebotcazou@libertysurf.fr>
PR optimization/11637
abort ();
}
else
- emit_insn_after (move, p);
+ {
+ if (control_flow_insn_p (p))
+ /* p can cause a control flow transfer so it
+ is the last insn of a basic block. We can't
+ therefore use emit_insn_after. */
+ emit_insn_before (move, next_nonnote_insn (p));
+ else
+ emit_insn_after (move, p);
+ }
}
break;
}
+2003-10-06 Wolfgang Bangerth <bangerth@ticam.utexas.edu>
+
+ * g++.dg/opt/cfg2.C: New test.
+
2003-10-06 Eric Botcazou <ebotcazou@libertysurf.fr>
* g++.dg/opt/float1.C: New test.
--- /dev/null
+// PR optimization/12215
+// Origin: <nick@ilm.com>
+// Reduced testcase by Wolfgang Bangerth <bangerth@ticam.utexas.edu>
+
+// This used to fail because the CSE pass destroyed the CFG in presence
+// of trapping loads, which led to the deletion of basic blocks.
+
+// { dg-do compile }
+// { dg-options "-O2 -fno-gcse -fnon-call-exceptions" }
+
+
+struct B {
+ ~B() throw() {}
+};
+
+struct X {
+ X(const char*, const B&);
+ ~X() {}
+};
+
+bool m();
+void f(int &i, float &arg0);
+
+void g (const char **argv) {
+ float val;
+ int i = 1;
+
+ try {
+ while ( i < 1 )
+ {
+ X arg(argv[i], B());
+ if (m())
+ throw(0);
+
+ f(i, val);
+ }
+ } catch (...) {}
+}