tree.c (build_type_no_quals): New function.
authorAndrew Haley <aph@redhat.com>
Wed, 15 Nov 2000 14:39:14 +0000 (14:39 +0000)
committerAndrew Haley <aph@gcc.gnu.org>
Wed, 15 Nov 2000 14:39:14 +0000 (14:39 +0000)
2000-11-13  Andrew Haley  <aph@redhat.com>

        * tree.c (build_type_no_quals): New function.
        * tree.h (build_type_no_quals): Declare.
        * c-common.c (c_get_alias_set): When considering type
        compatibility for pointer types, ignore cv-qualifiers anywhere in
        a pointer chain.

From-SVN: r37479

gcc/ChangeLog
gcc/c-common.c
gcc/tree.c
gcc/tree.h

index 60efafb3265e22ff2f898909ac07f0e829012d81..69ad2e9d1682ce278ea142f605f8c01f7f0bd83e 100644 (file)
@@ -1,3 +1,11 @@
+2000-11-13  Andrew Haley  <aph@redhat.com>
+
+       * tree.c (build_type_no_quals): New function.
+       * tree.h (build_type_no_quals): Declare.
+       * c-common.c (c_get_alias_set): When considering type
+       compatibility for pointer types, ignore cv-qualifiers anywhere in
+       a pointer chain.
+
 2000-11-15  Graham Stott  <grahams@redhat.com>
 
        * regrename.c (scan_rtx_rtx): Skip to the next chain on
index e0d8a45a4a5120dee87a47cca95740a1d9966933..50620f0ec6a457d3d4a66be421a9b7be751a9be1 100644 (file)
@@ -4794,9 +4794,7 @@ lang_get_alias_set (t)
         can dereference IPP and CIPP.  So, we ignore cv-qualifiers on
         the pointed-to types.  This issue has been reported to the
         C++ committee.  */
-      t1 = TYPE_MAIN_VARIANT (TREE_TYPE (t));
-      t1 = ((TREE_CODE (t) == POINTER_TYPE)
-          ? build_pointer_type (t1) : build_reference_type (t1));
+      t1 = build_type_no_quals (t);
       if (t1 != t)
        return get_alias_set (t1);
     }
index 4b3e9300efcc6f79607abd641101ef4251d1ecb2..7e820f559cee3a1bba209d5731c8c992593c1b08 100644 (file)
@@ -3798,6 +3798,26 @@ build_reference_type (to_type)
   return t;
 }
 
+/* Build a type that is compatible with t but has no cv quals anywhere
+   in its type, thus
+
+   const char *const *const *  ->  char ***.  */
+
+tree
+build_type_no_quals (t)
+  tree t;
+{
+  switch (TREE_CODE (t))
+    {
+    case POINTER_TYPE:
+      return build_pointer_type (build_type_no_quals (TREE_TYPE (t)));
+    case REFERENCE_TYPE:
+      return build_reference_type (build_type_no_quals (TREE_TYPE (t)));
+    default:
+      return TYPE_MAIN_VARIANT (t);
+    }
+}
+
 /* Create a type of integers to be the TYPE_DOMAIN of an ARRAY_TYPE.
    MAXVAL should be the maximum value in the domain
    (one less than the length of the array).
index ed28507af7da35b2ba534c7d81a9c911c29f2a15..a264df4fbdc0f012cb879b71a930f62f9fe6aff0 100644 (file)
@@ -1923,6 +1923,7 @@ extern tree signed_or_unsigned_type       PARAMS ((int, tree));
 extern void fixup_unsigned_type                PARAMS ((tree));
 extern tree build_pointer_type         PARAMS ((tree));
 extern tree build_reference_type       PARAMS ((tree));
+extern tree build_type_no_quals        PARAMS ((tree));
 extern tree build_index_type           PARAMS ((tree));
 extern tree build_index_2_type         PARAMS ((tree, tree));
 extern tree build_array_type           PARAMS ((tree, tree));