diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-09-21 08:17:48 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-09-21 08:17:48 +0000 |
commit | 9ef1d65ae38b026784e9b98bf4cf23754b05ef0c (patch) | |
tree | c123406ad7e9e90e5fce7905e31e32346d1768ea /gcc | |
parent | 9bc3739ff5286405148970f7ec7db806dc17440d (diff) | |
download | gcc-9ef1d65ae38b026784e9b98bf4cf23754b05ef0c.tar.gz |
PR target/12301
* reorg.c (stop_search_p): Return 1 for insns that can
throw internally.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@71620 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/reorg.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/eh/delayslot1.C | 47 |
4 files changed, 63 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 35f2fba3a61..ca9c54098ea 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +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. diff --git a/gcc/reorg.c b/gcc/reorg.c index 3d7159daa7c..6a13fe0634b 100644 --- a/gcc/reorg.c +++ b/gcc/reorg.c @@ -235,6 +235,12 @@ stop_search_p (rtx insn, int labels_p) 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: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a65e623fd40..11c7cff5343 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +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. diff --git a/gcc/testsuite/g++.dg/eh/delayslot1.C b/gcc/testsuite/g++.dg/eh/delayslot1.C new file mode 100644 index 00000000000..ddc960e6d8b --- /dev/null +++ b/gcc/testsuite/g++.dg/eh/delayslot1.C @@ -0,0 +1,47 @@ +// 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; +} |