From: Richard Kenner Date: Mon, 5 Jul 2004 15:09:06 +0000 (+0000) Subject: expr.c (expand_expr_real_1, [...]): Don't check against bounds if bounds aren't constant. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ebd5a2087cf3c7e1d2f8d005ef6a1d14c7cdc6e1;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a0023646c05..a8e9522dbf8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -5,6 +5,9 @@ 2004-07-05 Richard Kenner + * 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 b44309ded60..efca348f547 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));