Commit 021ed367 by Richard Guenther Committed by Richard Biener

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
parent d02a5a4b
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
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment