+2004-12-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/18384, c++/18327
+ * decl.c (reshape_init_array): Use UHWI type for max_index_cst
+ and index. Convert max_index to size_type_node if it isn't
+ host_integerp (, 1).
+
2004-12-23 Alexandre Oliva <aoliva@redhat.com>
PR c++/18962
tree *initp, tree new_init)
{
bool sized_array_p = (max_index != NULL_TREE);
- HOST_WIDE_INT max_index_cst = 0;
- HOST_WIDE_INT index;
+ unsigned HOST_WIDE_INT max_index_cst = 0;
+ unsigned HOST_WIDE_INT index;
if (sized_array_p)
- /* HWI is either 32bit or 64bit, so it must be enough to represent the
- array size. */
- max_index_cst = tree_low_cst (max_index, 1);
+ {
+ if (host_integerp (max_index, 1))
+ max_index_cst = tree_low_cst (max_index, 1);
+ /* sizetype is sign extended, not zero extended. */
+ else
+ max_index_cst = tree_low_cst (convert (size_type_node, max_index), 1);
+ }
/* Loop until there are no more initializers. */
for (index = 0;
TREE_PURPOSE (element_init) = NULL_TREE;
}
else
- {
- if (TREE_CODE (designated_index) != INTEGER_CST)
- abort ();
- if (sized_array_p
- && tree_int_cst_lt (max_index, designated_index))
- {
- error ("Designated initializer `%E' larger than array "
- "size", designated_index);
- TREE_PURPOSE (element_init) = NULL_TREE;
- }
- else
- index = tree_low_cst (designated_index, 1);
- }
+ abort ();
}
}
+2004-12-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/18384, c++/18327
+ * g++.dg/init/array18.C: New test.
+
2004-12-23 Alexandre Oliva <aoliva@redhat.com>
PR target/16819