OSDN Git Service

* tree.c (array_type_nelts): Make sure the domain of TYPE is set
authorbrendan <brendan@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 22 Jul 1997 19:25:25 +0000 (19:25 +0000)
committerbrendan <brendan@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 22 Jul 1997 19:25:25 +0000 (19:25 +0000)
        before we try to use it.

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

gcc/tree.c

index 58a4173..0f91d7b 100644 (file)
@@ -2147,9 +2147,16 @@ tree
 array_type_nelts (type)
      tree type;
 {
-  tree index_type = TYPE_DOMAIN (type);
-  tree min = TYPE_MIN_VALUE (index_type);
-  tree max = TYPE_MAX_VALUE (index_type);
+  tree index_type, min, max;
+
+  /* If they did it with unspecified bounds, then we should have already
+     given an error about it before we got here.  */
+  if (! TYPE_DOMAIN (type))
+    return error_mark_node;
+
+  index_type = TYPE_DOMAIN (type);
+  min = TYPE_MIN_VALUE (index_type);
+  max = TYPE_MAX_VALUE (index_type);
 
   if (! TREE_CONSTANT (min))
     {