+2002-03-28 Richard Henderson <rth@redhat.com>
+
+ PR target/6087
+ * reload1.c (fixup_abnormal_edges): Move insn to edge via sequence.
+
2002-03-28 Alexandre Oliva <aoliva@redhat.com>
* config/i386/freebsd.h (LINK_SPEC): Don't pass default
next = NEXT_INSN (insn);
if (INSN_P (insn))
{
- insert_insn_on_edge (PATTERN (insn), e);
+ rtx seq;
+
delete_insn (insn);
+
+ /* We're not deleting it, we're moving it. */
+ INSN_DELETED_P (insn) = 0;
+
+ /* Emit a sequence, rather than scarfing the pattern, so
+ that we don't lose REG_NOTES etc. */
+ /* ??? Could copy the test from gen_sequence, but don't
+ think it's worth the bother. */
+ seq = gen_rtx_SEQUENCE (VOIDmode, gen_rtvec (1, insn));
+ insert_insn_on_edge (seq, e);
}
insn = next;
}
--- /dev/null
+// PR target/6087
+// The code that moves around insns emitted by reg-stack to cope with
+// exception edges lost the REG_DEAD note indicating a pop. Which
+// eventually fills up the register stack resulting in Z == NaN.
+
+// { dg-do run }
+// { dg-options "-O" }
+
+extern "C" void abort ();
+
+struct Base
+{
+ virtual ~Base() {}
+};
+
+struct Foo : public Base
+{
+ Foo ();
+};
+
+double x = 3;
+double y = 4;
+
+double bar ()
+{
+ double z = x*x+y*y;
+ if (z != 25.0)
+ throw 1;
+ return z;
+}
+
+Foo::Foo ()
+{
+ bar ();
+}
+
+int main ()
+{
+ try {
+ int i;
+ for (i = 0; i < 10; ++i)
+ new Foo;
+ } catch (...) {
+ abort ();
+ }
+ return 0;
+}