aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2004-07-05 15:09:06 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2004-07-05 11:09:06 -0400
commitebd5a2087cf3c7e1d2f8d005ef6a1d14c7cdc6e1 (patch)
tree0053914a182dbe72587756537a694ee69c19a1c4 /gcc
parent6f70e46e0daf8965e8026ec7302afda9efc04a4d (diff)
downloadgcc-ebd5a2087cf3c7e1d2f8d005ef6a1d14c7cdc6e1.zip
gcc-ebd5a2087cf3c7e1d2f8d005ef6a1d14c7cdc6e1.tar.gz
gcc-ebd5a2087cf3c7e1d2f8d005ef6a1d14c7cdc6e1.tar.bz2
expr.c (expand_expr_real_1, [...]): Don't check against bounds if bounds aren't constant.
* expr.c (expand_expr_real_1, case SWITCH_EXPR): Don't check against bounds if bounds aren't constant. From-SVN: r84117
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog3
-rw-r--r--gcc/expr.c20
2 files changed, 15 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a002364..a8e9522 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -5,6 +5,9 @@
2004-07-05 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+ * expr.c (expand_expr_real_1, case SWITCH_EXPR): Don't check against
+ bounds if bounds aren't constant.
+
* tree-cfg.c (verify_expr): Use CHECK_OP in binary case.
* function.c, langhooks-def.h, langhooks.h: Move max_size hook
diff --git a/gcc/expr.c b/gcc/expr.c
index b44309d..efca348 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -9221,8 +9221,9 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
if (case_low && case_high)
{
/* Case label is less than minimum for type. */
- if ((tree_int_cst_compare (case_low, min_value) < 0)
- && (tree_int_cst_compare (case_high, min_value) < 0))
+ if (TREE_CODE (min_value) == INTEGER_CST
+ && tree_int_cst_compare (case_low, min_value) < 0
+ && tree_int_cst_compare (case_high, min_value) < 0)
{
warning ("case label value %d is less than minimum value for type",
TREE_INT_CST (case_low));
@@ -9230,8 +9231,9 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
}
/* Case value is greater than maximum for type. */
- if ((tree_int_cst_compare (case_low, max_value) > 0)
- && (tree_int_cst_compare (case_high, max_value) > 0))
+ if (TREE_CODE (max_value) == INTEGER_CST
+ && tree_int_cst_compare (case_low, max_value) > 0
+ && tree_int_cst_compare (case_high, max_value) > 0)
{
warning ("case label value %d exceeds maximum value for type",
TREE_INT_CST (case_high));
@@ -9239,8 +9241,9 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
}
/* Saturate lower case label value to minimum. */
- if ((tree_int_cst_compare (case_high, min_value) >= 0)
- && (tree_int_cst_compare (case_low, min_value) < 0))
+ if (TREE_CODE (min_value) == INTEGER_CST
+ && tree_int_cst_compare (case_high, min_value) >= 0
+ && tree_int_cst_compare (case_low, min_value) < 0)
{
warning ("lower value %d in case label range less than minimum value for type",
TREE_INT_CST (case_low));
@@ -9248,8 +9251,9 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
}
/* Saturate upper case label value to maximum. */
- if ((tree_int_cst_compare (case_low, max_value) <= 0)
- && (tree_int_cst_compare (case_high, max_value) > 0))
+ if (TREE_CODE (max_value) == INTEGER_CST
+ && tree_int_cst_compare (case_low, max_value) <= 0
+ && tree_int_cst_compare (case_high, max_value) > 0)
{
warning ("upper value %d in case label range exceeds maximum value for type",
TREE_INT_CST (case_high));