aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorTom Wood <wood@gnu.org>1992-06-27 10:21:04 +0000
committerTom Wood <wood@gnu.org>1992-06-27 10:21:04 +0000
commitf59028696ad31fa3caeba83f0b47271095fc883c (patch)
tree0ea33d00009f19b44689b20363bf90ee74c996eb /gcc/fold-const.c
parent9aea9597cff287e07ff3f55ade3d8a9567a5278f (diff)
downloadgcc-f59028696ad31fa3caeba83f0b47271095fc883c.zip
gcc-f59028696ad31fa3caeba83f0b47271095fc883c.tar.gz
gcc-f59028696ad31fa3caeba83f0b47271095fc883c.tar.bz2
*** empty log message ***
From-SVN: r1306
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 6c406f6..e1ad1ca 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -2399,7 +2399,13 @@ range_test (jcode, type, lo_code, hi_code, var, lo_cst, hi_cst)
/* When normalizing, it is possible to both increment the smaller constant
and decrement the larger constant. See if they are still ordered. */
- if (tree_int_cst_lt (lo_cst, hi_cst))
+ if (tree_int_cst_lt (hi_cst, lo_cst))
+ return 0;
+
+ /* Fail if VAR isn't an integer. */
+ utype = TREE_TYPE (var);
+ if (TREE_CODE (utype) != INTEGER_TYPE
+ && TREE_CODE (utype) != ENUMERAL_TYPE)
return 0;
/* The range test is invalid if subtracting the two constants results
@@ -2408,7 +2414,6 @@ range_test (jcode, type, lo_code, hi_code, var, lo_cst, hi_cst)
|| ! int_fits_type_p (lo_cst, TREE_TYPE (var)))
return 0;
- utype = TREE_TYPE (var);
if (! TREE_UNSIGNED (utype))
{
utype = unsigned_type (utype);