aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 1f2e919..626f8e4 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -4174,6 +4174,15 @@ build_distinct_type_copy (tree type)
TYPE_MAIN_VARIANT (t) = t;
TYPE_NEXT_VARIANT (t) = 0;
+ /* VRP assumes that TREE_TYPE (TYPE_MIN_VALUE (type)) == type. */
+ if (INTEGRAL_TYPE_P (t) || SCALAR_FLOAT_TYPE_P (t))
+ {
+ if (TYPE_MIN_VALUE (t) != NULL_TREE)
+ TYPE_MIN_VALUE (t) = fold_convert (t, TYPE_MIN_VALUE (t));
+ if (TYPE_MAX_VALUE (t) != NULL_TREE)
+ TYPE_MAX_VALUE (t) = fold_convert (t, TYPE_MAX_VALUE (t));
+ }
+
return t;
}