fix inappropriate use of TYPE_DOMAIN in cp/decl.c (was Re: new FAILs on HEAD)
Zack Weinberg
zack@codesourcery.com
Sat May 1 19:12:00 GMT 2004
Michael Ritzert <gcc@ds217-115-141-84.dedicated.hosteurope.de> writes:
> These new FAILs appeared since the last run:
>
> FAIL: g++.dg/ext/vector1.C (test for excess errors)
My bad; fixed thus. This is not the minimal patch; that would have
left us not enforcing initializer bounds on vectors at all, which was
the status quo, but I thought it unwise.
zw
cp:
* decl.c (reshape_init): Do not apply TYPE_DOMAIN to a VECTOR_TYPE.
Instead, dig into the representation type to find the array bound.
===================================================================
Index: cp/decl.c
--- cp/decl.c 30 Apr 2004 15:51:52 -0000 1.1203
+++ cp/decl.c 1 May 2004 18:58:24 -0000
@@ -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));
More information about the Gcc-regression
mailing list