aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2018-08-25 19:12:36 +0000
committerJeff Law <law@gcc.gnu.org>2018-08-25 13:12:36 -0600
commit75e96bc80cf32a302c27bdbbec1ec7119a690857 (patch)
tree5a6e123e085eed215bd3edb996c21d13da4f07d2 /gcc/fold-const.c
parent3d6fc627f6cb78ecf280622c05eed59e9150a5c7 (diff)
downloadgcc-75e96bc80cf32a302c27bdbbec1ec7119a690857.zip
gcc-75e96bc80cf32a302c27bdbbec1ec7119a690857.tar.gz
gcc-75e96bc80cf32a302c27bdbbec1ec7119a690857.tar.bz2
re PR tree-optimization/87059 (internal compiler error: in set_value_range, at tree-vrp.c:289)
PR tree-optimization/87059 * builtins.c (expand_builtin_strncmp): Convert MIN_EXPR operand to the same type as the other. * fold-const.c (fold_binary_loc): Assert expectation. From-SVN: r263855
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index b318fc7..1e44a24 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -9326,6 +9326,14 @@ fold_binary_loc (location_t loc, enum tree_code code, tree type,
if (kind == tcc_comparison || code == MIN_EXPR || code == MAX_EXPR)
{
+ if (code == MIN_EXPR || code == MAX_EXPR)
+ {
+ tree typ0 = TREE_TYPE (arg0);
+ tree typ1 = TREE_TYPE (arg1);
+ gcc_assert (TYPE_SIGN (typ0) == TYPE_SIGN (typ1)
+ && TYPE_MODE (typ0) == TYPE_MODE (typ1));
+ }
+
STRIP_SIGN_NOPS (arg0);
STRIP_SIGN_NOPS (arg1);
}