]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/16536 (Incorrect __restrict__ optimization in -O2)
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Fri, 10 Dec 2004 17:25:07 +0000 (17:25 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Fri, 10 Dec 2004 17:25:07 +0000 (17:25 +0000)
PR rtl-optimization/16536
Backport from mainline:
2004-06-25  Mark Mitchell  <mark@codesourcery.com>
* alias.c (get_alias_set): Adjust setting of
DECL_POINTER_ALIAS_SET for pointers to aggregates.

* gcc.c-torture/execute/restrict-1.c: New test.

From-SVN: r91999

gcc/ChangeLog
gcc/alias.c
gcc/testsuite/ChangeLog

index 47caee0b970559a5c74775604abfedb3b86e72f8..05f9b6cbce5cdaec758542c71dd21b4bd990f2b5 100644 (file)
@@ -1,3 +1,11 @@
+2004-12-10  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR rtl-optimization/16536
+       Backport from mainline:
+       2004-06-25  Mark Mitchell  <mark@codesourcery.com>
+       * alias.c (get_alias_set): Adjust setting of
+       DECL_POINTER_ALIAS_SET for pointers to aggregates.
+
 2004-12-09  Richard Henderson  <rth@redhat.com>
 
        PR target/17025
index abc98de7557adb54a17febcabe422b6a6436c85b..75ac89d065b7f588efbff745a3e6bb9cff6f046d 100644 (file)
@@ -508,6 +508,8 @@ get_alias_set (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
@@ -516,11 +518,22 @@ get_alias_set (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 ();
index 9f9958a91afe64f56958c27efe83df0bb2165ba6..f9d369063b219fee089f56edbc2d66a3d5182213 100644 (file)
@@ -1,3 +1,8 @@
+2004-12-10  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR rtl-optimization/16536
+       * gcc.c-torture/execute/restrict-1.c: New test.
+
 2004-12-09  Nathan Sidwell  <nathan@codesourcery.com>
 
        PR c++/16681