gimple.c (gimple_types_compatible_p): Restrict completing types to record or unions.

2009-10-16  Richard Guenther  <rguenther@suse.de>

	* gimple.c (gimple_types_compatible_p): Restrict completing
	types to record or unions.  Simplify completion.
	Do not merge records or unions with different
	TYPE_STRUCTURAL_EQUALITY_P tag.
	(iterative_hash_gimple_type): Restrict non-recursing into
	pointer targets for records and unions.

From-SVN: r152898
This commit is contained in:
Richard Guenther 2009-10-16 11:44:46 +00:00 committed by Richard Biener
parent d02a5a4b9a
commit 021ed367a5
2 changed files with 22 additions and 3 deletions

View File

@ -1,3 +1,12 @@
2009-10-16 Richard Guenther <rguenther@suse.de>
* gimple.c (gimple_types_compatible_p): Restrict completing
types to record or unions. Simplify completion.
Do not merge records or unions with different
TYPE_STRUCTURAL_EQUALITY_P tag.
(iterative_hash_gimple_type): Restrict non-recursing into
pointer targets for records and unions.
2009-10-15 Jakub Jelinek <jakub@redhat.com>
PR debug/41717

View File

@ -3413,13 +3413,17 @@ gimple_types_compatible_p (tree t1, tree t2)
/* If one pointer points to an incomplete type variant of
the other pointed-to type they are the same. */
if (TREE_CODE (TREE_TYPE (t1)) == TREE_CODE (TREE_TYPE (t2))
&& RECORD_OR_UNION_TYPE_P (TREE_TYPE (t1))
&& (!COMPLETE_TYPE_P (TREE_TYPE (t1))
|| !COMPLETE_TYPE_P (TREE_TYPE (t2)))
&& compare_type_names_p (TREE_TYPE (t1), TREE_TYPE (t2), true))
{
/* If t2 is complete we want to choose it instead of t1. */
/* Replace the pointed-to incomplete type with the
complete one. */
if (COMPLETE_TYPE_P (TREE_TYPE (t2)))
gimple_force_type_merge (TREE_TYPE (t1), TREE_TYPE (t2));
TREE_TYPE (t1) = TREE_TYPE (t2);
else
TREE_TYPE (t2) = TREE_TYPE (t1);
goto same_types;
}
@ -3470,6 +3474,12 @@ gimple_types_compatible_p (tree t1, tree t2)
{
tree f1, f2;
/* If one type requires structural equality checks and the
other doesn't, do not merge the types. */
if (TYPE_STRUCTURAL_EQUALITY_P (t1)
!= TYPE_STRUCTURAL_EQUALITY_P (t2))
goto different_types;
/* The struct tags shall compare equal. */
if (!compare_type_names_p (TYPE_MAIN_VARIANT (t1),
TYPE_MAIN_VARIANT (t2), false))
@ -3667,7 +3677,7 @@ iterative_hash_gimple_type (tree type, hashval_t val,
avoid hash differences for complete vs. incomplete types. */
if (POINTER_TYPE_P (type))
{
if (AGGREGATE_TYPE_P (TREE_TYPE (type)))
if (RECORD_OR_UNION_TYPE_P (TREE_TYPE (type)))
{
v = iterative_hash_hashval_t (TREE_CODE (TREE_TYPE (type)), v);
v = iterative_hash_name