diff options
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/c-common.c | 5 | ||||
-rw-r--r-- | gcc/c-typeck.c | 64 |
3 files changed, 11 insertions, 67 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6fe91ef..fbcf2df 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,14 @@ 2004-11-15 Joseph S. Myers <joseph@codesourcery.com> + * c-common.c (binary_op_error): Don't allow LROTATE_EXPR, + RROTATE_EXPR or unknown code. + * c-typeck.c (build_binary_op): Don't allow RROTATE_EXPR, + LROTATE_EXPR, MAX_EXPR, MIN_EXPR, UNORDERED_EXPR, ORDERED_EXPR, + UNLT_EXPR, UNLE_EXPR, UNGT_EXPR, UNGE_EXPR, UNEQ_EXPR, LTGT_EXPR + or unknown code. + +2004-11-15 Joseph S. Myers <joseph@codesourcery.com> + PR c/18498 * c-decl.c (grokdeclarator): Call check_bitfield_type_and_width after processing the declarator. diff --git a/gcc/c-common.c b/gcc/c-common.c index ba77501..81bdbbf 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -1863,11 +1863,8 @@ binary_op_error (enum tree_code code) opname = "||"; break; case BIT_XOR_EXPR: opname = "^"; break; - case LROTATE_EXPR: - case RROTATE_EXPR: - opname = "rotate"; break; default: - opname = "unknown"; break; + gcc_unreachable (); } error ("invalid operands to binary %s", opname); } diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 6be4d6b..90ca0de 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -7281,29 +7281,6 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, } break; - case RROTATE_EXPR: - case LROTATE_EXPR: - if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE) - { - if (TREE_CODE (op1) == INTEGER_CST && skip_evaluation == 0) - { - if (tree_int_cst_sgn (op1) < 0) - warning ("shift count is negative"); - else if (compare_tree_int (op1, TYPE_PRECISION (type0)) >= 0) - warning ("shift count >= width of type"); - } - - /* Use the type of the value to be shifted. */ - result_type = type0; - /* Convert the shift-count to an integer, regardless of size - of value being shifted. */ - if (TYPE_MAIN_VARIANT (TREE_TYPE (op1)) != integer_type_node) - op1 = convert (integer_type_node, op1); - /* Avoid converting op1 to result_type later. */ - converted = 1; - } - break; - case EQ_EXPR: case NE_EXPR: if (warn_float_equal && (code0 == REAL_TYPE || code1 == REAL_TYPE)) @@ -7365,28 +7342,6 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, } break; - case MAX_EXPR: - case MIN_EXPR: - if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE) - && (code1 == INTEGER_TYPE || code1 == REAL_TYPE)) - shorten = 1; - else if (code0 == POINTER_TYPE && code1 == POINTER_TYPE) - { - if (comp_target_types (type0, type1, 1)) - { - result_type = common_pointer_type (type0, type1); - if (pedantic - && TREE_CODE (TREE_TYPE (type0)) == FUNCTION_TYPE) - pedwarn ("ISO C forbids ordered comparisons of pointers to functions"); - } - else - { - result_type = ptr_type_node; - pedwarn ("comparison of distinct pointer types lacks a cast"); - } - } - break; - case LE_EXPR: case GE_EXPR: case LT_EXPR: @@ -7439,25 +7394,8 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, } break; - case UNORDERED_EXPR: - case ORDERED_EXPR: - case UNLT_EXPR: - case UNLE_EXPR: - case UNGT_EXPR: - case UNGE_EXPR: - case UNEQ_EXPR: - case LTGT_EXPR: - build_type = integer_type_node; - if (code0 != REAL_TYPE || code1 != REAL_TYPE) - { - error ("unordered comparison on non-floating point argument"); - return error_mark_node; - } - common = 1; - break; - default: - break; + gcc_unreachable (); } if (code0 == ERROR_MARK || code1 == ERROR_MARK) |