aboutsummaryrefslogtreecommitdiff
path: root/gcc/alias.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-06-11 18:19:28 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-06-11 18:19:28 +0000
commit4653cae5b8dc090912f262572d0105f27ec2c83b (patch)
tree7589856308b10e4f1fc7740be354b769d8e54ff6 /gcc/alias.c
parent8981c15b8cbb3a7e129c7bcf85823eff3db9c6a7 (diff)
downloadgcc-4653cae5b8dc090912f262572d0105f27ec2c83b.zip
gcc-4653cae5b8dc090912f262572d0105f27ec2c83b.tar.gz
gcc-4653cae5b8dc090912f262572d0105f27ec2c83b.tar.bz2
alias.c (get_alias_set): Use the element alias-set for arrays.
2008-06-11 Richard Guenther <rguenther@suse.de> * alias.c (get_alias_set): Use the element alias-set for arrays. (record_component_aliases): For arrays and vectors do nothing. * c-common.c (strict_aliasing_warning): Handle the cases of alias set zero explicitly. * Makefile.in (dfp.o-warn): Add -Wno-error. From-SVN: r136679
Diffstat (limited to 'gcc/alias.c')
-rw-r--r--gcc/alias.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/gcc/alias.c b/gcc/alias.c
index 06ad867..ec2d053 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -640,6 +640,18 @@ 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 ();
@@ -747,11 +759,6 @@ record_component_aliases (tree type)
switch (TREE_CODE (type))
{
- case ARRAY_TYPE:
- if (!TYPE_NONALIASED_COMPONENT (type))
- record_alias_subset (superset, get_alias_set (TREE_TYPE (type)));
- break;
-
case RECORD_TYPE:
case UNION_TYPE:
case QUAL_UNION_TYPE:
@@ -775,6 +782,9 @@ record_component_aliases (tree type)
record_alias_subset (superset, get_alias_set (TREE_TYPE (type)));
break;
+ /* VECTOR_TYPE and ARRAY_TYPE share the alias set with their
+ element type. */
+
default:
break;
}