File pr45502.diff of Package gcc43
Index: gcc-4.3.4-20091019/gcc/alias.c
===================================================================
--- gcc-4.3.4-20091019.orig/gcc/alias.c 2010-09-03 14:19:56.000000000 +0200
+++ gcc-4.3.4-20091019/gcc/alias.c 2010-09-03 14:22:26.000000000 +0200
@@ -305,7 +305,7 @@ alias_set_subset_of (alias_set_type set1
/* Otherwise, check if set1 is a subset of set2. */
ase = get_alias_set_entry (set2);
if (ase != 0
- && ((ase->has_zero_child && set1 == 0)
+ && (ase->has_zero_child
|| splay_tree_lookup (ase->children,
(splay_tree_key) set1)))
return true;
@@ -647,6 +647,17 @@ get_alias_set (tree t)
else if (TREE_CODE (t) == VECTOR_TYPE)
set = get_alias_set (TREE_TYPE (t));
+ /* Unless the language specifies otherwise, treat array types the
+ same as their components. This avoids the asymmetry we get
+ through recording the components. Consider accessing a
+ character(kind=1) through a reference to a character(kind=1)[1:1].
+ Or consider if we want to assign integer(kind=4)[0:D.1387] and
+ integer(kind=4)[4] the same alias set or not.
+ Just be pragmatic here and make sure the array and its element
+ type get the same alias set assigned. */
+ else if (TREE_CODE (t) == ARRAY_TYPE && !TYPE_NONALIASED_COMPONENT (t))
+ set = get_alias_set (TREE_TYPE (t));
+
else
/* Otherwise make a new alias set for this type. */
set = new_alias_set ();