From 158f4e4f46cab61f09dfce1ff2ac7dbfec8bb615 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Fri, 16 Aug 2013 14:59:02 +0000 Subject: [PATCH] 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. From-SVN: r201791 --- gcc/ChangeLog | 6 ++++++ gcc/gengtype.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cc51207..e71ae3e 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 2085496..9c12752 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); -- 2.7.4