]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree.c (array_type_nelts): Make sure the domain of TYPE is set before we try to use it.
authorBrendan Kehoe <brendan@gcc.gnu.org>
Tue, 22 Jul 1997 19:25:25 +0000 (15:25 -0400)
committerBrendan Kehoe <brendan@gcc.gnu.org>
Tue, 22 Jul 1997 19:25:25 +0000 (15:25 -0400)
        * tree.c (array_type_nelts): Make sure the domain of TYPE is set
        before we try to use it.

From-SVN: r14518

gcc/tree.c

index 58a4173d420d705b91a4410cd9b43b1deaaa8431..0f91d7b116411c645b17c8778184be3600126c9a 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))
     {