aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorZack Weinberg <zack@codesourcery.com>2004-05-01 19:12:46 +0000
committerZack Weinberg <zack@gcc.gnu.org>2004-05-01 19:12:46 +0000
commitf8e7a389e9794b2d70c698db7e43bc4f9fffb5a7 (patch)
tree26decb362522a6068bf3ffbaeb72fd137c329749 /gcc
parentea2637ebbad17a4db3173d4136dbfb2271ad77f7 (diff)
downloadgcc-f8e7a389e9794b2d70c698db7e43bc4f9fffb5a7.zip
gcc-f8e7a389e9794b2d70c698db7e43bc4f9fffb5a7.tar.gz
gcc-f8e7a389e9794b2d70c698db7e43bc4f9fffb5a7.tar.bz2
decl.c (reshape_init): Do not apply TYPE_DOMAIN to a VECTOR_TYPE.
* decl.c (reshape_init): Do not apply TYPE_DOMAIN to a VECTOR_TYPE. Instead, dig into the representation type to find the array bound. From-SVN: r81393
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog9
-rw-r--r--gcc/cp/decl.c18
2 files changed, 23 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0f0a5e2..bc900be 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2004-05-01 Zack Weinberg <zack@codesourcery.com>
+
+ * decl.c (reshape_init): Do not apply TYPE_DOMAIN to a VECTOR_TYPE.
+ Instead, dig into the representation type to find the array bound.
+
2004-04-30 Jason Merrill <jason@redhat.com>
Refer to base members using COMPONENT_REFs where possible.
@@ -23,7 +28,7 @@
* init.c (build_aggr_init): Fix accidental use of C99 construct in
previous change.
-
+
* class.c (initialize_array): Don't set TREE_HAS_CONSTRUCTOR on
braced initializer.
* cp-tree.h (BRACE_ENCLOSED_INITIALIZER_P): New macro.
@@ -42,7 +47,7 @@
(class_initializer): Likewise.
(get_pseudo_ti_init): Likewise.
* typeck2.c (digest_init): Use BRACE_ENCLOSED_INITIALIZER_P.
-
+
2004-04-22 Alan Modra <amodra@bigpond.net.au>
* name-lookup.c (anonymous_namespace_name): Make static.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index f589868..1b78831 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -4289,8 +4289,22 @@ reshape_init (tree type, tree *initp)
/* If the bound of the array is known, take no more initializers
than are allowed. */
- max_index = ((TYPE_DOMAIN (type) && (TREE_CODE (type) == ARRAY_TYPE))
- ? array_type_nelts (type) : NULL_TREE);
+ max_index = NULL_TREE;
+ if (TREE_CODE (type) == ARRAY_TYPE)
+ {
+ if (TYPE_DOMAIN (type))
+ max_index = array_type_nelts (type);
+ }
+ else
+ {
+ /* For a vector, the representation type is a struct
+ containing a single member which is an array of the
+ appropriate size. */
+ tree rtype = TYPE_DEBUG_REPRESENTATION_TYPE (type);
+ if (rtype && TYPE_DOMAIN (TREE_TYPE (TYPE_FIELDS (rtype))))
+ max_index = array_type_nelts (TREE_TYPE (TYPE_FIELDS (rtype)));
+ }
+
/* Loop through the array elements, gathering initializers. */
for (index = size_zero_node;
*initp && (!max_index || !tree_int_cst_lt (max_index, index));