aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-07-09 13:19:22 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2009-07-09 13:19:22 +0200
commitb9da76de89731a1f9be1d256157dfec4cdf5d323 (patch)
treeef158423e9e6bf499dd3aa0f69fbbffcf173b836 /gcc/fold-const.c
parentd175a2fa7c0abcf211c2522eaf01361ea3a6a7ce (diff)
downloadgcc-b9da76de89731a1f9be1d256157dfec4cdf5d323.zip
gcc-b9da76de89731a1f9be1d256157dfec4cdf5d323.tar.gz
gcc-b9da76de89731a1f9be1d256157dfec4cdf5d323.tar.bz2
re PR middle-end/40692 (Endless recursion between fold_ternary and fold_cond_expr_with_comparison)
PR middle-end/40692 * fold-const.c (fold_cond_expr_with_comparison): Don't replace arg1 with arg01 if arg1 is already INTEGER_CST. * gcc.c-torture/compile/pr40692.c: New test. From-SVN: r149418
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 670fa45..f3e0614 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -5303,6 +5303,8 @@ fold_cond_expr_with_comparison (tree type, tree arg0, tree arg1, tree arg2)
switch (comp_code)
{
case EQ_EXPR:
+ if (TREE_CODE (arg1) == INTEGER_CST)
+ break;
/* We can replace A with C1 in this case. */
arg1 = fold_convert (type, arg01);
return fold_build3 (COND_EXPR, type, arg0, arg1, arg2);