This is the mail archive of the
mailing list for the GCC project.
patch to fix tentative struct type collision
- From: Fariborz Jahanian <fjahanian at apple dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 5 Dec 2006 11:21:10 -0800
- Subject: 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 (email@example.com)
2006-12-05 Fariborz Jahanian <firstname.lastname@example.org>
* tree.c (type_hash_eq): Check for TYPE_NAME of two colliding
tentative struct/union types.
*** tree.c (revision 119530)
--- tree.c (working copy)
*************** type_hash_eq (const void *va, const void
*** 4214,4219 ****
--- 4214,4221 ----
+ 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