PR target/12301
* reorg.c (stop_search_p): Return 1 for insns that can
throw internally.
From-SVN: r71620
+2003-09-21 Eric Botcazou <ebotcazou@libertysurf.fr>
+
+ PR target/12301
+ * reorg.c (stop_search_p): Return 1 for insns that can
+ throw internally.
+
2003-09-20 Richard Henderson <rth@redhat.com>
* c-format.c (gcc_diag_char_table): Add %J.
if (insn == 0)
return 1;
+ /* If the insn can throw an exception that is caught within the function,
+ it may effectively perform a jump from the viewpoint of the function.
+ Therefore act like for a jump. */
+ if (can_throw_internal (insn))
+ return 1;
+
switch (GET_CODE (insn))
{
case NOTE:
+2003-09-21 Christian Ehrhardt <ehrhardt@mathematik.uni-ulm.de>
+
+ * g++.dg/eh/delayslot1.C: New test.
+
2003-09-20 Richard Henderson <rth@redhat.com>
* gcc.dg/format/gcc_diag-1.c: Add tests for %J.
--- /dev/null
+// PR target/12301
+// Origin: Colin Hirsch <gcc@cohi.at>
+// Testcase by Christian Ehrhardt <ehrhardt@mathematik.uni-ulm.de>
+
+// This used to fail on SPARC because the reorg pass moved an insn
+// across a function call that can throw internally, in order to put
+// it in a delay slot.
+
+// { dg-do run }
+// { dg-options "-O" }
+
+struct S{
+ char *c;
+ char data[100];
+ S () : c (data) {};
+ S (const S& s) {
+ c = data;
+ data[0] = s.c[0];
+ }
+};
+
+S real_cast ()
+{
+ throw 3;
+}
+
+S cast_helper(S& debug)
+{
+ try {
+ return real_cast();
+ }
+ catch (int e) {
+ throw debug;
+ }
+}
+
+int main()
+{
+ S tmp;
+
+ try {
+ cast_helper (tmp);
+ }
+ catch (S& e) {}
+
+ return 0;
+}