Commit ca4feb54 by Jason Merrill Committed by Jason Merrill

typeck2.c (digest_init, [...]): Treat vectors like arrays.

        * typeck2.c (digest_init, process_init_constructor): Treat vectors
        like arrays.

From-SVN: r49726
parent aebfea10
2002-02-13 Jason Merrill <jason@redhat.com>
* typeck2.c (digest_init, process_init_constructor): Treat vectors
like arrays.
2002-02-11 Jason Merrill <jason@redhat.com> 2002-02-11 Jason Merrill <jason@redhat.com>
* parse.y (reserved_declspecs): Don't handle attributes. * parse.y (reserved_declspecs): Don't handle attributes.
......
...@@ -544,7 +544,7 @@ digest_init (type, init, tail) ...@@ -544,7 +544,7 @@ digest_init (type, init, tail)
if (code == INTEGER_TYPE || code == REAL_TYPE || code == POINTER_TYPE if (code == INTEGER_TYPE || code == REAL_TYPE || code == POINTER_TYPE
|| code == ENUMERAL_TYPE || code == REFERENCE_TYPE || code == ENUMERAL_TYPE || code == REFERENCE_TYPE
|| code == BOOLEAN_TYPE || code == COMPLEX_TYPE || code == VECTOR_TYPE || code == BOOLEAN_TYPE || code == COMPLEX_TYPE
|| TYPE_PTRMEMFUNC_P (type)) || TYPE_PTRMEMFUNC_P (type))
{ {
if (raw_constructor) if (raw_constructor)
...@@ -578,7 +578,7 @@ digest_init (type, init, tail) ...@@ -578,7 +578,7 @@ digest_init (type, init, tail)
return error_mark_node; return error_mark_node;
} }
if (code == ARRAY_TYPE || IS_AGGR_TYPE_CODE (code)) if (code == ARRAY_TYPE || code == VECTOR_TYPE || IS_AGGR_TYPE_CODE (code))
{ {
if (raw_constructor && TYPE_NON_AGGREGATE_CLASS (type) if (raw_constructor && TYPE_NON_AGGREGATE_CLASS (type)
&& TREE_HAS_CONSTRUCTOR (init)) && TREE_HAS_CONSTRUCTOR (init))
...@@ -598,7 +598,7 @@ digest_init (type, init, tail) ...@@ -598,7 +598,7 @@ digest_init (type, init, tail)
return process_init_constructor (type, 0, tail); return process_init_constructor (type, 0, tail);
} }
if (code != ARRAY_TYPE) if (CLASS_TYPE_P (type))
{ {
int flags = LOOKUP_NORMAL; int flags = LOOKUP_NORMAL;
/* Initialization from { } is copy-initialization. */ /* Initialization from { } is copy-initialization. */
...@@ -659,18 +659,26 @@ process_init_constructor (type, init, elts) ...@@ -659,18 +659,26 @@ process_init_constructor (type, init, elts)
for each element of this aggregate. Chain them together in result. for each element of this aggregate. Chain them together in result.
If there are too few, use 0 for each scalar ultimate component. */ If there are too few, use 0 for each scalar ultimate component. */
if (TREE_CODE (type) == ARRAY_TYPE) if (TREE_CODE (type) == ARRAY_TYPE || TREE_CODE (type) == VECTOR_TYPE)
{ {
tree domain = TYPE_DOMAIN (type);
register long len; register long len;
register int i; register int i;
if (domain) if (TREE_CODE (type) == ARRAY_TYPE)
len = (TREE_INT_CST_LOW (TYPE_MAX_VALUE (domain)) {
- TREE_INT_CST_LOW (TYPE_MIN_VALUE (domain)) tree domain = TYPE_DOMAIN (type);
+ 1); if (domain)
len = (TREE_INT_CST_LOW (TYPE_MAX_VALUE (domain))
- TREE_INT_CST_LOW (TYPE_MIN_VALUE (domain))
+ 1);
else
len = -1; /* Take as many as there are */
}
else else
len = -1; /* Take as many as there are */ {
/* Vectors are like simple fixed-size arrays. */
len = TYPE_VECTOR_SUBPARTS (type);
}
for (i = 0; len < 0 || i < len; i++) for (i = 0; len < 0 || i < len; i++)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment