OSDN Git Service

cp:
[pf3gnuchains/gcc-fork.git] / gcc / alias.c
index cdbb94d..4806019 100644 (file)
@@ -395,9 +395,14 @@ find_base_decl (tree t)
   if (t == 0 || t == error_mark_node || ! POINTER_TYPE_P (TREE_TYPE (t)))
     return 0;
 
-  /* If this is a declaration, return it.  */
+  /* If this is a declaration, return it.  If T is based on a restrict
+     qualified decl, return that decl.  */
   if (DECL_P (t))
-    return t;
+    {
+      if (TREE_CODE (t) == VAR_DECL && DECL_BASED_ON_RESTRICT_P (t))
+       t = DECL_GET_RESTRICT_BASE (t);
+      return t;
+    }
 
   /* Handle general expressions.  It would be nice to deal with
      COMPONENT_REFs here.  If we could tell that `a' and `b' were the
@@ -1952,13 +1957,13 @@ nonoverlapping_component_refs_p (tree x, tree y)
       do
        {
          fieldx = TREE_OPERAND (x, 1);
-         typex = DECL_FIELD_CONTEXT (fieldx);
+         typex = TYPE_MAIN_VARIANT (DECL_FIELD_CONTEXT (fieldx));
 
          y = orig_y;
          do
            {
              fieldy = TREE_OPERAND (y, 1);
-             typey = DECL_FIELD_CONTEXT (fieldy);
+             typey = TYPE_MAIN_VARIANT (DECL_FIELD_CONTEXT (fieldy));
 
              if (typex == typey)
                goto found;
@@ -1971,7 +1976,7 @@ nonoverlapping_component_refs_p (tree x, tree y)
        }
       while (x && TREE_CODE (x) == COMPONENT_REF);
       /* Never found a common type.  */
-      return true;
+      return false;
 
     found:
       /* If we're left with accessing different fields of a structure,