summaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-09 09:00:42 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-09 09:00:42 +0000
commit51164bd614a79d1e0201be48cda8a4b19da43dac (patch)
tree063d723468f59c5153bc0412704ffd0946b73ba1 /gcc/fold-const.c
parent2f26863b9e66c405df3a0a154bd534b0e17615f3 (diff)
downloadgcc-51164bd614a79d1e0201be48cda8a4b19da43dac.tar.gz
2005-09-09 Richard Guenther <rguenther@suse.de>
PR c++/23624 * fold-const.c (fold_ternary): Check truth_value_p before calling invert_truthvalue. * g++.dg/tree-ssa/pr23624.C: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104083 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 2f024b42e02..4b41adfc59f 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -10006,7 +10006,8 @@ fold_ternary (enum tree_code code, tree type, tree op0, tree op1, tree op2)
/* If the second operand is simpler than the third, swap them
since that produces better jump optimization results. */
- if (tree_swap_operands_p (op1, op2, false))
+ if (truth_value_p (TREE_CODE (arg0))
+ && tree_swap_operands_p (op1, op2, false))
{
/* See if this can be inverted. If it can't, possibly because
it was a floating-point inequality comparison, don't do