From: dmalcolm Date: Fri, 16 Aug 2013 14:59:02 +0000 (+0000) Subject: Fix bad interaction between GTY((user)) and incomplete declarations X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=05d261851dbf046045d7cb2e7be3fdcae3e09ae6;p=thirdparty%2Fgcc.git Fix bad interaction between GTY((user)) and incomplete declarations gcc/ * gengtype.c (create_user_defined_type): Ensure that the kind is set to TYPE_USER_STRUCT, fixing a bug seen when an incomplete declaration is seen before the GTY((user)) marking. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@201791 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cc512075d070..e71ae3edbf74 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-08-16 David Malcolm + + * gengtype.c (create_user_defined_type): Ensure that the kind + is set to TYPE_USER_STRUCT, fixing a bug seen when an incomplete + declaration is seen before the GTY((user)) marking. + 2013-08-16 Bernd Edlinger PR target/58105 diff --git a/gcc/gengtype.c b/gcc/gengtype.c index 20854966facf..9c1275227331 100644 --- a/gcc/gengtype.c +++ b/gcc/gengtype.c @@ -559,6 +559,12 @@ type_p create_user_defined_type (const char *type_name, struct fileloc *pos) { type_p ty = find_structure (type_name, TYPE_USER_STRUCT); + + /* We might have already seen an incomplete decl of the given type, + in which case we won't have yet seen a GTY((user)), and the type will + only have kind "TYPE_STRUCT". Mark it as a user struct. */ + ty->kind = TYPE_USER_STRUCT; + ty->u.s.line = *pos; ty->u.s.bitmap = get_lang_bitmap (pos->file); do_typedef (type_name, ty, pos);