mirror of
https://gcc.gnu.org/git/gcc.git
synced 2026-02-22 03:46:53 -05:00
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: r124238
This commit is contained in:
committed by
Ian Lance Taylor
parent
eaf8ebdea7
commit
2e0bf5de87
@@ -1,3 +1,9 @@
|
||||
2007-04-27 Ian Lance Taylor <iant@google.com>
|
||||
|
||||
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.
|
||||
|
||||
2007-04-26 Ian Lance Taylor <iant@google.com>
|
||||
|
||||
PR target/28675
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2007-04-27 Ian Lance Taylor <iant@google.com>
|
||||
|
||||
PR middle-end/31710
|
||||
* gcc.c-torture/compile/pr31710.c: New test.
|
||||
|
||||
2007-04-26 Ian Lance Taylor <iant@google.com>
|
||||
|
||||
PR target/28675
|
||||
|
||||
6
gcc/testsuite/gcc.c-torture/compile/pr31710.c
Normal file
6
gcc/testsuite/gcc.c-torture/compile/pr31710.c
Normal file
@@ -0,0 +1,6 @@
|
||||
typedef short SHORT;
|
||||
struct v { SHORT i; };
|
||||
void f(struct v *pin, struct v *pout) {
|
||||
if (pin->i == (-0x7fff)-1)
|
||||
pout->i = -pin->i;
|
||||
}
|
||||
@@ -3882,6 +3882,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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user