aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@cygnus.com>1997-12-18 15:20:19 -0800
committerJeff Law <law@gcc.gnu.org>1997-12-18 16:20:19 -0700
commite1ee5cdcbf209d2f16473a2ff6e91ff774edb3e7 (patch)
treef6256a46a8fe9fd54c5f8fa94aaed268e376f33b /gcc/tree.c
parent8342981f2de7306bf857c96b8b418be8882a0c63 (diff)
downloadgcc-e1ee5cdcbf209d2f16473a2ff6e91ff774edb3e7.zip
gcc-e1ee5cdcbf209d2f16473a2ff6e91ff774edb3e7.tar.gz
gcc-e1ee5cdcbf209d2f16473a2ff6e91ff774edb3e7.tar.bz2
tree.c (build_range_type): Allow creation of ranges with no maximum.
* tree.c (build_range_type): Allow creation of ranges with no maximum. * dbxout.c (dbxout_range_type): Handle missing TYPE_MAX_VALUE. * dwarf2out.c (add_subscript_info): Likewise. * dwarfout.c (subscript_data_attribute, byte_size_attribute): Likewise. * sdbout.c (plain_type_1): Likewise. * stmt.c (pushcase_range, all_cases_count, node_has_high_bound): Likewise. * fold-const.c (int_const_binop, fold_convert, make_range, fold): Likewise. From-SVN: r17142
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 7b150eb..492b673 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -4002,19 +4002,25 @@ build_range_type (type, lowval, highval)
push_obstacks (TYPE_OBSTACK (itype), TYPE_OBSTACK (itype));
TYPE_MIN_VALUE (itype) = convert (type, lowval);
- TYPE_MAX_VALUE (itype) = convert (type, highval);
+ TYPE_MAX_VALUE (itype) = highval ? convert (type, highval) : NULL;
pop_obstacks ();
TYPE_PRECISION (itype) = TYPE_PRECISION (type);
TYPE_MODE (itype) = TYPE_MODE (type);
TYPE_SIZE (itype) = TYPE_SIZE (type);
TYPE_ALIGN (itype) = TYPE_ALIGN (type);
- if ((TREE_CODE (lowval) == INTEGER_CST)
- && (TREE_CODE (highval) == INTEGER_CST))
+ if (TREE_CODE (lowval) == INTEGER_CST)
{
- HOST_WIDE_INT highint = TREE_INT_CST_LOW (highval);
- HOST_WIDE_INT lowint = TREE_INT_CST_LOW (lowval);
- int maxint = (int) (highint - lowint);
+ HOST_WIDE_INT lowint, highint;
+ int maxint;
+
+ lowint = TREE_INT_CST_LOW (lowval);
+ if (highval && TREE_CODE (highval) == INTEGER_CST)
+ highint = TREE_INT_CST_LOW (highval);
+ else
+ highint = (~(unsigned HOST_WIDE_INT)0) >> 1;
+
+ maxint = (int) (highint - lowint);
return type_hash_canon (maxint < 0 ? ~maxint : maxint, itype);
}
else