aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Haley <aph@redhat.com>2000-11-15 14:39:14 +0000
committerAndrew Haley <aph@gcc.gnu.org>2000-11-15 14:39:14 +0000
commit12e1243e426a12358e793cef2735e77c37452ec7 (patch)
tree125e489e2c90a52e691eac99b293650f052b66f7
parent71631a1f1ce6cba9b823cb48a2bff17e97e2664f (diff)
downloadgcc-12e1243e426a12358e793cef2735e77c37452ec7.zip
gcc-12e1243e426a12358e793cef2735e77c37452ec7.tar.gz
gcc-12e1243e426a12358e793cef2735e77c37452ec7.tar.bz2
tree.c (build_type_no_quals): New function.
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
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/c-common.c4
-rw-r--r--gcc/tree.c20
-rw-r--r--gcc/tree.h1
4 files changed, 30 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 60efafb..69ad2e9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/c-common.c b/gcc/c-common.c
index e0d8a45..50620f0 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -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);
}
diff --git a/gcc/tree.c b/gcc/tree.c
index 4b3e930..7e820f5 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -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).
diff --git a/gcc/tree.h b/gcc/tree.h
index ed28507..a264df4 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -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));