------- Comment #4 from rguenth at gcc dot gnu dot org 2009-08-24 12:53 -------
We're layouting an array with incomplete element type and get into
if (!TYPE_SIZE (element))
/* We don't know the size of the underlying element type, so
our alignment calculations will be wrong, forcing us to
fall back on structural equality. */
SET_TYPE_STRUCTURAL_EQUALITY (type);
later re-using this type when building the same array type with complete
element type as the canonical variant.
IMHO the above is simply bogus.
To test patch:
Index: stor-layout.c
===================================================================
--- stor-layout.c (revision 151050)
+++ stor-layout.c (working copy)
@@ -2020,11 +2020,6 @@ layout_type (tree type)
#else
TYPE_ALIGN (type) = MAX (TYPE_ALIGN (element), BITS_PER_UNIT);
#endif
- if (!TYPE_SIZE (element))
- /* We don't know the size of the underlying element type, so
- our alignment calculations will be wrong, forcing us to
- fall back on structural equality. */
- SET_TYPE_STRUCTURAL_EQUALITY (type);
TYPE_USER_ALIGN (type) = TYPE_USER_ALIGN (element);
SET_TYPE_MODE (type, BLKmode);
if (TYPE_SIZE (type) != 0
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41144