aboutsummaryrefslogtreecommitdiff
path: root/gcc/reorg.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2001-07-20 02:38:57 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2001-07-20 02:38:57 +0000
commitbe672de8aefdbad33db28b2fa397bafde5c39e0c (patch)
treebe9419d5a426c224fc7741680b50eccd11561a52 /gcc/reorg.c
parent3b73bce168137059e4c4bcaca6ce575f001ab8df (diff)
downloadgcc-be672de8aefdbad33db28b2fa397bafde5c39e0c.zip
gcc-be672de8aefdbad33db28b2fa397bafde5c39e0c.tar.gz
gcc-be672de8aefdbad33db28b2fa397bafde5c39e0c.tar.bz2
reorg.c (fill_simple_delay_slots): If an instruction might throw an exception that will be caught within this...
* reorg.c (fill_simple_delay_slots): If an instruction might throw an exception that will be caught within this function, do not fill its delay slot with any subsequent instruction. From-SVN: r44171
Diffstat (limited to 'gcc/reorg.c')
-rw-r--r--gcc/reorg.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/reorg.c b/gcc/reorg.c
index b521645..1f26e7e 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -2223,6 +2223,27 @@ fill_simple_delay_slots (non_jumps_p)
fill_eager_delay_slots anyways, it was just deleted. */
if (slots_filled != slots_to_fill
+ /* If this instruction could throw an exception which is
+ caught in the same function, then it's not safe to fill
+ the delay slot with an instruction from beyond this
+ point. For example, consider:
+
+ int i = 2;
+
+ try {
+ f();
+ i = 3;
+ } catch (...) {}
+
+ return i;
+
+ Even though `i' is a local variable, we must be sure not
+ to put `i = 3' in the delay slot if `f' might throw an
+ exception.
+
+ Presumably, we should also check to see if we could get
+ back to this function via `setjmp'. */
+ && !can_throw_internal (insn)
&& (GET_CODE (insn) != JUMP_INSN
|| ((condjump_p (insn) || condjump_in_parallel_p (insn))
&& ! simplejump_p (insn)