aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2004-01-18 20:04:59 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2004-01-18 20:04:59 +0000
commit6e46ab25d4b257be152420fc71ce58b76d7b033e (patch)
tree6b199a82523b528d9de5ea680ad44a33702fe2c3 /gcc/builtins.c
parentb4be9e8e86ef2580b079b0ccf3d439af93cb2faa (diff)
downloadgcc-6e46ab25d4b257be152420fc71ce58b76d7b033e.zip
gcc-6e46ab25d4b257be152420fc71ce58b76d7b033e.tar.gz
gcc-6e46ab25d4b257be152420fc71ce58b76d7b033e.tar.bz2
builtins.c (expand_builtin_expect_jump): Fix thinko of reusing live "next" variable, which can lead to an infinite loop.
* builtins.c (expand_builtin_expect_jump): Fix thinko of reusing live "next" variable, which can lead to an infinite loop. From-SVN: r76111
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index d34cbd6..3174e75 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -4458,7 +4458,7 @@ expand_builtin_expect_jump (tree exp, rtx if_false_label, rtx if_true_label)
if (TREE_CODE (TREE_TYPE (arg1)) == INTEGER_TYPE
&& (integer_zerop (arg1) || integer_onep (arg1)))
{
- rtx insn, drop_through_label;
+ rtx insn, drop_through_label, temp;
/* Expand the jump insns. */
start_sequence ();
@@ -4511,13 +4511,15 @@ expand_builtin_expect_jump (tree exp, rtx if_false_label, rtx if_true_label)
if (next && GET_CODE (next) == JUMP_INSN
&& any_uncondjump_p (next))
- next = XEXP (SET_SRC (pc_set (next)), 0);
+ temp = XEXP (SET_SRC (pc_set (next)), 0);
+ else
+ temp = next;
- /* NEXT is either a CODE_LABEL, NULL_RTX or something
+ /* TEMP is either a CODE_LABEL, NULL_RTX or something
else that can't possibly match either target label. */
- if (next == if_false_label)
+ if (temp == if_false_label)
taken = 1;
- else if (next == if_true_label)
+ else if (temp == if_true_label)
taken = 0;
}
else if (then_dest == pc_rtx)
@@ -4527,11 +4529,13 @@ expand_builtin_expect_jump (tree exp, rtx if_false_label, rtx if_true_label)
if (next && GET_CODE (next) == JUMP_INSN
&& any_uncondjump_p (next))
- next = XEXP (SET_SRC (pc_set (next)), 0);
+ temp = XEXP (SET_SRC (pc_set (next)), 0);
+ else
+ temp = next;
- if (next == if_false_label)
+ if (temp == if_false_label)
taken = 0;
- else if (next == if_true_label)
+ else if (temp == if_true_label)
taken = 1;
}