------- Additional Comments From steven at gcc dot gnu dot org 2004-12-15
15:14 -------
methinks the bug is in this code:
/* ??? This bit ought not be needed. For any element not present
in the initializer, we should simply set them to zero. Except
we'd need to *find* the elements that are not present, and that
requires trickery to avoid quadratic compile-time behavior in
large cases or excessive memory use in small cases. */
else
{
HOST_WIDE_INT len = list_length (elt_list);
if (TREE_CODE (type) == ARRAY_TYPE)
{
tree nelts = array_type_nelts (type);
if (!host_integerp (nelts, 1)
|| tree_low_cst (nelts, 1) + 1 != len)
cleared = true;
}
else if (len != fields_length (type))
cleared = true;
}
We have this expr:
objD.1485 = {{.sD.1468=(const charD.1 *) (charD.1 *) "m0"}, {}}
The type of the constructor is an ARRAY_TYPE, nelts == 1, and len (the length
of the constructor) is 2. So nelts+1 == 2, and we set cleared = true. But
we ignore the fact that the second element of the constructor is empty, and
that the first one is incomplete.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18241