From 093b203ba9a0b34d78ef2972e687fd5ca03a952b Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 27 Apr 2007 20:47:24 +0000 Subject: re PR middle-end/31710 (ICE in in set_value_range, at tree-vrp.c:278) ./: PR middle-end/31710 * tree.c (build_distinct_type_copy): If TYPE_MIN_VALUE or TYPE_MAX_VALUE exist, convert them to the new type. testsuite/: PR middle-end/31710 * gcc.c-torture/compile/pr31710.c: New test. From-SVN: r124237 --- gcc/tree.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gcc/tree.c') 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; } -- cgit v1.1