@@ -6894,15 +6894,20 @@ reshape_init_array_1 (tree elt_type, tree max_index, reshape_iter *d,
if (sized_array_p)
{
+ poly_uint64 midx;
/* Minus 1 is used for zero sized arrays. */
if (integer_all_onesp (max_index))
return new_init;
- if (tree_fits_uhwi_p (max_index))
- max_index_cst = tree_to_uhwi (max_index);
+ if (tree_fits_poly_uint64_p (max_index))
+ midx = tree_to_poly_uint64 (max_index);
/* sizetype is sign extended, not zero extended. */
else
- max_index_cst = tree_to_uhwi (fold_convert (size_type_node, max_index));
+ midx = tree_to_poly_uint64 (fold_convert (size_type_node, max_index));
+
+ /* For VLA vectors, we restict the number of elements in the constructor
+ to lower bound of the VLA elements. */
+ max_index_cst = constant_lower_bound (midx);
}
/* Loop until there are no more initializers. */
@@ -124,6 +124,8 @@ void thrower2 () throw (svint8_t); // { dg-error {cannot throw or catch SVE type
void thrower3 () throw (svint8_t); // { dg-error {cannot throw or catch SVE type 'svint8_t'} "" { target c++98_only } }
#endif
+extern int bar (void);
+
// Main tests for statements and expressions.
void
@@ -161,6 +163,15 @@ statements (int n)
svint8_t init_sve_sc5 = {};
svint8_t init_sve_sc6 = { sve_sc1 };
svint8_t init_sve_sc7 = { sve_sh1 }; // { dg-error {cannot convert 'svint16_t' to 'svint8_t'} }
+ svint32_t init_sve_vc1 = { 0, 1 };
+ svint32_t init_sve_vc2 = { 0, bar () };
+ svint32_t init_sve_vc3 = { bar (), n };
+ svint32_t init_sve_vc4 = { 0, 1, 2, 3 };
+ svint32_t init_sve_vc5 = { 0, 1, bar (), 3 };
+ svint32_t init_sve_vc6 = { 0, 1, 2, 3, 4 }; // { dg-error {too many initializers for 'svint32_t'} }
+ svint32_t init_sve_vc7 = { 0, 1, 2, 3, bar () }; // { dg-error {too many initializers for 'svint32_t'} }
+ svint32_t init_sve_vc8 = { 0, 1, 2, 3, 4, 5 }; // { dg-error {too many initializers for 'svint32_t'} }
+ svint32_t init_sve_vc9 = { 0, bar (), 2, 3, 4, n }; // { dg-error {too many initializers for 'svint32_t'} }
// Constructor calls.
@@ -161,6 +161,15 @@ statements (int n)
svint8_t init_sve_sc5 = {};
svint8_t init_sve_sc6 = { sve_sc1 };
svint8_t init_sve_sc7 = { sve_sh1 }; // { dg-error {cannot convert 'svint16_t' to 'svint8_t'} }
+ svint32_t init_sve_vc1 = { 0, 1 };
+ svint32_t init_sve_vc2 = { 0, bar () };
+ svint32_t init_sve_vc3 = { bar (), n };
+ svint32_t init_sve_vc4 = { 0, 1, 2, 3, 4, 5, 6, 7 };
+ svint32_t init_sve_vc5 = { 0, 1, bar (), 3, 4, 5, n, 7 };
+ svint32_t init_sve_vc6 = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; // { dg-error {too many initializers for 'svint32_t'} }
+ svint32_t init_sve_vc7 = { 0, 1, 2, 3, bar (), 5, 6, 7, n }; // { dg-error {too many initializers for 'svint32_t'} }
+ svint32_t init_sve_vc8 = { 0, bar (), 2, 3, 4, n, 5, 6, 7, 8, 9 }; // { dg-error {too many initializers for 'svint32_t'} }
+ svint32_t init_sve_vc9 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; // { dg-error {too many initializers for 'svint32_t'} }
// Constructor calls.