aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorBrendan Kehoe <brendan@gcc.gnu.org>1997-07-22 15:25:25 -0400
committerBrendan Kehoe <brendan@gcc.gnu.org>1997-07-22 15:25:25 -0400
commit7671d67b18474ccaf6e8422bf48f6fa67694bbc4 (patch)
treefc7e25f6b39be8bd9ea0d49967e18cd010508a47 /gcc/tree.c
parentefc9daa36e39dd8970be51bd835e0cf3d67568ae (diff)
downloadgcc-7671d67b18474ccaf6e8422bf48f6fa67694bbc4.zip
gcc-7671d67b18474ccaf6e8422bf48f6fa67694bbc4.tar.gz
gcc-7671d67b18474ccaf6e8422bf48f6fa67694bbc4.tar.bz2
tree.c (array_type_nelts): Make sure the domain of TYPE is set before we try to use it.
* tree.c (array_type_nelts): Make sure the domain of TYPE is set before we try to use it. From-SVN: r14518
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 58a4173..0f91d7b 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -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))
{