This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

patch to fix tentative struct type collision

When searching for a tentative struct type in type_hash_eq, if it collides with another similar type, currently type_hash_eq says it is a match since both types' TYPE_FIELDS is NULL. This is incorrect and causes bad things to happen as it matches "struct foo' with "struct bar", for example. I ran into this problem when made a call to build_type_attribute_variant to create a new duplicate type with new attributes. Attach patch, which is dejagnu and bootstrap tested on apple-x86-darwin, fixes the problem.

OK for FSF's main trunk?

- Fariborz (


2006-12-05 Fariborz Jahanian <>

        * tree.c (type_hash_eq): Check for TYPE_NAME of two colliding
        tentative struct/union types.

Index: tree.c
*** tree.c      (revision 119530)
--- tree.c      (working copy)
*************** type_hash_eq (const void *va, const void
*** 4214,4219 ****
--- 4214,4221 ----
      case RECORD_TYPE:
      case UNION_TYPE:
      case QUAL_UNION_TYPE:
+       if (!TYPE_FIELDS (a->type) && !TYPE_FIELDS (b->type))
+       return TYPE_NAME (a->type) == TYPE_NAME (b->type);
        return (TYPE_FIELDS (a->type) == TYPE_FIELDS (b->type)
              || (TYPE_FIELDS (a->type)
                  && TREE_CODE (TYPE_FIELDS (a->type)) == TREE_LIST

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]