diff options
author | Richard Guenther <rguenther@suse.de> | 2009-10-16 11:44:46 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2009-10-16 11:44:46 +0000 |
commit | 021ed367a561125c90bef393b0a641d3cc9a7d51 (patch) | |
tree | e3285c8807c40362340fe1e7d5599db1724a125e /gcc/gimple.c | |
parent | d02a5a4b9abb043ff6a243bb4f9a9aaac2fb8656 (diff) | |
download | gcc-021ed367a561125c90bef393b0a641d3cc9a7d51.zip gcc-021ed367a561125c90bef393b0a641d3cc9a7d51.tar.gz gcc-021ed367a561125c90bef393b0a641d3cc9a7d51.tar.bz2 |
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
Diffstat (limited to 'gcc/gimple.c')
-rw-r--r-- | gcc/gimple.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/gcc/gimple.c b/gcc/gimple.c index e953066..105fb1b 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -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 |