aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-12-02 18:15:17 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-12-02 18:15:17 +0000
commit8e281a8d56cb86f1d9502450713e3f5dc8c4608f (patch)
tree8637795c0a6bfcdb6f4f62c93e08956055e098a1
parent4b90314e2c790740fec39db21698b290d8e903d7 (diff)
downloadgcc-8e281a8d56cb86f1d9502450713e3f5dc8c4608f.zip
gcc-8e281a8d56cb86f1d9502450713e3f5dc8c4608f.tar.gz
gcc-8e281a8d56cb86f1d9502450713e3f5dc8c4608f.tar.bz2
re PR middle-end/41491 (ICE in set_value_range, at tree-vrp.c:386)
2009-12-02 Richard Guenther <rguenther@suse.de> PR middle-end/41491 * fold-const.c (try_move_mult_to_index): Do not leak domain types into the IL. From-SVN: r154920
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/fold-const.c20
2 files changed, 17 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1700570..2860355 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2009-12-02 Richard Guenther <rguenther@suse.de>
+ PR middle-end/41491
+ * fold-const.c (try_move_mult_to_index): Do not leak
+ domain types into the IL.
+
+2009-12-02 Richard Guenther <rguenther@suse.de>
+
PR middle-end/42088
* tree.c (free_lang_data): Disable if not using LTO.
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 1a77dd5..37475a0 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -7586,13 +7586,16 @@ try_move_mult_to_index (location_t loc, tree addr, tree op1)
{
if (TREE_CODE (ref) == ARRAY_REF)
{
+ tree domain;
+
/* Remember if this was a multi-dimensional array. */
if (TREE_CODE (TREE_OPERAND (ref, 0)) == ARRAY_REF)
mdim = true;
- itype = TYPE_DOMAIN (TREE_TYPE (TREE_OPERAND (ref, 0)));
- if (! itype)
+ domain = TYPE_DOMAIN (TREE_TYPE (TREE_OPERAND (ref, 0)));
+ if (! domain)
continue;
+ itype = TREE_TYPE (domain);
step = array_ref_element_size (ref);
if (TREE_CODE (step) != INTEGER_CST)
@@ -7619,18 +7622,17 @@ try_move_mult_to_index (location_t loc, tree addr, tree op1)
tree tmp;
if (TREE_CODE (TREE_OPERAND (ref, 1)) != INTEGER_CST
- || !INTEGRAL_TYPE_P (itype)
- || !TYPE_MAX_VALUE (itype)
- || TREE_CODE (TYPE_MAX_VALUE (itype)) != INTEGER_CST)
+ || !TYPE_MAX_VALUE (domain)
+ || TREE_CODE (TYPE_MAX_VALUE (domain)) != INTEGER_CST)
continue;
tmp = fold_binary_loc (loc, PLUS_EXPR, itype,
- fold_convert_loc (loc, itype,
- TREE_OPERAND (ref, 1)),
- fold_convert_loc (loc, itype, delta));
+ fold_convert_loc (loc, itype,
+ TREE_OPERAND (ref, 1)),
+ fold_convert_loc (loc, itype, delta));
if (!tmp
|| TREE_CODE (tmp) != INTEGER_CST
- || tree_int_cst_lt (TYPE_MAX_VALUE (itype), tmp))
+ || tree_int_cst_lt (TYPE_MAX_VALUE (domain), tmp))
continue;
}