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.
Tested on aarch64-linux-gnu. Probably bordering on obvious, but just in case: OK to install? Richard 2018-01-23 Richard Sandiford <richard.sandif...@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. Index: gcc/fold-const.c =================================================================== --- gcc/fold-const.c 2018-01-16 15:13:19.643832679 +0000 +++ gcc/fold-const.c 2018-01-23 11:23:59.982555852 +0000 @@ -8572,39 +8572,39 @@ fold_comparison (location_t loc, enum tr { 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:; } Index: gcc/testsuite/g++.dg/pr83979.c =================================================================== --- /dev/null 2018-01-22 18:46:35.983712806 +0000 +++ gcc/testsuite/g++.dg/pr83979.c 2018-01-23 11:23:59.982555852 +0000 @@ -0,0 +1,7 @@ +/* { dg-compile } */ + +int +foo (char* p) +{ + return p + 1000 < p; +}