[Bug c/42570] New: [4.5 Regression] ICE in get_alias_set, at alias.c:710

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Jan 1 13:43:00 GMT 2010


The C frontend disturbs the canonical type hierarchy for

typedef unsigned char uint8_t;
uint8_t foo[1][0];

./cc1 -quiet t.c -O2
t.c:2:1: internal compiler error: in get_alias_set, at alias.c:710
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

which is because the C frontend completes the zero-size array element type
in grokdeclarator because

               /* The GCC extension for zero-length arrays differs from
                  ISO flexible array members in that sizeof yields
                  zero.  */

so it doesn't get TYPE_STRUCTURAL_EQUALITY.  But the built canonical
type based on unsigned char[0] doesn't get this treatment and thus
will be treated with TYPE_STRUCTURAL_EQUALITY which will trigger the
assert.

Index: c-decl.c
===================================================================
--- c-decl.c    (revision 155535)
+++ c-decl.c    (working copy)
@@ -5394,6 +5394,7 @@ grokdeclarator (const struct c_declarato
                    gcc_assert (itype);
                    TYPE_SIZE (type) = bitsize_zero_node;
                    TYPE_SIZE_UNIT (type) = size_zero_node;
+                   SET_TYPE_STRUCTURAL_EQUALITY (type);
                  }
                if (array_parm_vla_unspec_p)
                  {

fixes it.


-- 
           Summary: [4.5 Regression] ICE in get_alias_set, at alias.c:710
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42570



More information about the Gcc-bugs mailing list