OSDN Git Service

(build_array_type): The main variant of an array type
authorrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 5 May 1993 03:18:13 +0000 (03:18 +0000)
committerrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 5 May 1993 03:18:13 +0000 (03:18 +0000)
should always be an array whose element type is the main variant.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@4328 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/tree.c

index 7f13a3e..3953c43 100644 (file)
@@ -2792,6 +2792,12 @@ build_array_type (elt_type, index_type)
   TREE_TYPE (t) = elt_type;
   TYPE_DOMAIN (t) = index_type;
 
+  /* The main variant of an array type should always
+     be an array whose element type is the main variant.  */
+  if (elt_type != TYPE_MAIN_VARIANT (elt_type))
+    TYPE_MAIN_VARIANT (t) = build_array_type (TYPE_MAIN_VARIANT (elt_type),
+                                             index_type);
+
   if (index_type == 0)
     return t;