diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2018-01-24 16:22:30 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2018-01-24 16:22:30 +0000 |
commit | 885a33e117bf7339ecb1d4f3ef12b817cbead81c (patch) | |
tree | 0fd1c2c6bcb52cf3e1074bed3d06770ca5e11520 /gcc/fold-const.c | |
parent | 35d93d1d8caeddb4d990c8391fff2587bed8a3cd (diff) | |
download | gcc-885a33e117bf7339ecb1d4f3ef12b817cbead81c.zip gcc-885a33e117bf7339ecb1d4f3ef12b817cbead81c.tar.gz gcc-885a33e117bf7339ecb1d4f3ef12b817cbead81c.tar.bz2 |
Fix use of boolean_true/false_node (PR 83979)
r255913 changed some constant_boolean_node calls to boolean_true_node
and boolean_false_node, which meant that the returned tree didn't
always have the right type.
2018-01-24 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
PR tree-optimization/83979
* fold-const.c (fold_comparison): Use constant_boolean_node
instead of boolean_{true,false}_node.
gcc/testsuite/
PR tree-optimization/83979
* g++.dg/pr83979.c: New test.
From-SVN: r257021
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 1ea3766..744c355 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -8572,39 +8572,39 @@ fold_comparison (location_t loc, enum tree_code code, tree type, { case EQ_EXPR: if (known_eq (bitpos0, bitpos1)) - return boolean_true_node; + return constant_boolean_node (true, type); if (known_ne (bitpos0, bitpos1)) - return boolean_false_node; + return constant_boolean_node (false, type); break; case NE_EXPR: if (known_ne (bitpos0, bitpos1)) - return boolean_true_node; + return constant_boolean_node (true, type); if (known_eq (bitpos0, bitpos1)) - return boolean_false_node; + return constant_boolean_node (false, type); break; case LT_EXPR: if (known_lt (bitpos0, bitpos1)) - return boolean_true_node; + return constant_boolean_node (true, type); if (known_ge (bitpos0, bitpos1)) - return boolean_false_node; + return constant_boolean_node (false, type); break; case LE_EXPR: if (known_le (bitpos0, bitpos1)) - return boolean_true_node; + return constant_boolean_node (true, type); if (known_gt (bitpos0, bitpos1)) - return boolean_false_node; + return constant_boolean_node (false, type); break; case GE_EXPR: if (known_ge (bitpos0, bitpos1)) - return boolean_true_node; + return constant_boolean_node (true, type); if (known_lt (bitpos0, bitpos1)) - return boolean_false_node; + return constant_boolean_node (false, type); break; case GT_EXPR: if (known_gt (bitpos0, bitpos1)) - return boolean_true_node; + return constant_boolean_node (true, type); if (known_le (bitpos0, bitpos1)) - return boolean_false_node; + return constant_boolean_node (false, type); break; default:; } |