aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2004-06-25 19:15:52 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2004-06-25 19:15:52 +0000
commita2d3fb51261d2c7c8ecad59a4270e558e885aace (patch)
treea7567c602d2f58762daefc23040540f890d619e4
parent3de45d63a63ba18c59222c20263e65a7ce883e9d (diff)
PR wrong-code/16129
* alias.c (get_alias_set): Adjust setting of DECL_POINTER_ALIAS_SET for pointers to aggregates. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-3_4-branch@83673 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/alias.c15
2 files changed, 20 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3f4a93d2d4d..4e39df32e5c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2004-06-25 Mark Mitchell <mark@codesourcery.com>
+
+ PR wrong-code/16129
+ * alias.c (get_alias_set): Adjust setting of
+ DECL_POINTER_ALIAS_SET for pointers to aggregates.
+
2004-06-25 Richard Sandiford <rsandifo@redhat.com>
PR target/16144
diff --git a/gcc/alias.c b/gcc/alias.c
index dab10acad9a..5cce5e4d16f 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -500,6 +500,8 @@ get_alias_set (tree t)
/* If we haven't computed the actual alias set, do it now. */
if (DECL_POINTER_ALIAS_SET (decl) == -2)
{
+ tree pointed_to_type = TREE_TYPE (TREE_TYPE (decl));
+
/* No two restricted pointers can point at the same thing.
However, a restricted pointer can point at the same thing
as an unrestricted pointer, if that unrestricted pointer
@@ -508,11 +510,22 @@ get_alias_set (tree t)
alias set for the type pointed to by the type of the
decl. */
HOST_WIDE_INT pointed_to_alias_set
- = get_alias_set (TREE_TYPE (TREE_TYPE (decl)));
+ = get_alias_set (pointed_to_type);
if (pointed_to_alias_set == 0)
/* It's not legal to make a subset of alias set zero. */
DECL_POINTER_ALIAS_SET (decl) = 0;
+ else if (AGGREGATE_TYPE_P (pointed_to_type))
+ /* For an aggregate, we must treat the restricted
+ pointer the same as an ordinary pointer. If we
+ were to make the type pointed to by the
+ restricted pointer a subset of the pointed-to
+ type, then we would believe that other subsets
+ of the pointed-to type (such as fields of that
+ type) do not conflict with the type pointed to
+ by the restricted pointer. */
+ DECL_POINTER_ALIAS_SET (decl)
+ = pointed_to_alias_set;
else
{
DECL_POINTER_ALIAS_SET (decl) = new_alias_set ();