aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2012-03-28 15:04:23 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2012-03-28 15:04:23 +0000
commit32e8bfc3f649f51969aa3ca63df162df25f5b9c8 (patch)
treed7fea528406e6279d99feabaf079aba69929b9a5 /gcc
parentf25a65f5d1c160e8e90bd8b4bfdc30437d00b482 (diff)
downloadgcc-32e8bfc3f649f51969aa3ca63df162df25f5b9c8.zip
gcc-32e8bfc3f649f51969aa3ca63df162df25f5b9c8.tar.gz
gcc-32e8bfc3f649f51969aa3ca63df162df25f5b9c8.tar.bz2
typeck2.c (process_init_constructor_array): Use the proper type for computing the array length.
2012-03-28 Richard Guenther <rguenther@suse.de> * typeck2.c (process_init_constructor_array): Use the proper type for computing the array length. From-SVN: r185919
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/typeck2.c11
2 files changed, 13 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0d9be4f..0c96065 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2012-03-28 Richard Guenther <rguenther@suse.de>
+
+ * typeck2.c (process_init_constructor_array): Use the proper
+ type for computing the array length.
+
2012-03-27 Meador Inge <meadori@codesourcery.com>
PR c++/52672
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 80a1d04..f9b525c 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -1054,9 +1054,14 @@ process_init_constructor_array (tree type, tree init,
{
tree domain = TYPE_DOMAIN (type);
if (domain)
- len = (TREE_INT_CST_LOW (TYPE_MAX_VALUE (domain))
- - TREE_INT_CST_LOW (TYPE_MIN_VALUE (domain))
- + 1);
+ len = double_int_ext
+ (double_int_add
+ (double_int_sub
+ (tree_to_double_int (TYPE_MAX_VALUE (domain)),
+ tree_to_double_int (TYPE_MIN_VALUE (domain))),
+ double_int_one),
+ TYPE_PRECISION (TREE_TYPE (domain)),
+ TYPE_UNSIGNED (TREE_TYPE (domain))).low;
else
unbounded = true; /* Take as many as there are. */
}