diff options
Diffstat (limited to 'gcc-4.8/gcc/c/c-typeck.c')
-rw-r--r-- | gcc-4.8/gcc/c/c-typeck.c | 58 |
1 files changed, 44 insertions, 14 deletions
diff --git a/gcc-4.8/gcc/c/c-typeck.c b/gcc-4.8/gcc/c/c-typeck.c index ddb6d3977..fc2a165dc 100644 --- a/gcc-4.8/gcc/c/c-typeck.c +++ b/gcc-4.8/gcc/c/c-typeck.c @@ -2666,7 +2666,7 @@ build_function_call (location_t loc, tree function, tree params) vec_alloc (v, list_length (params)); for (; params; params = TREE_CHAIN (params)) v->quick_push (TREE_VALUE (params)); - ret = build_function_call_vec (loc, function, v, NULL); + ret = c_build_function_call_vec (loc, function, v, NULL); vec_free (v); return ret; } @@ -2705,14 +2705,6 @@ build_function_call_vec (location_t loc, tree function, /* Convert anything with function type to a pointer-to-function. */ if (TREE_CODE (function) == FUNCTION_DECL) { - /* Implement type-directed function overloading for builtins. - resolve_overloaded_builtin and targetm.resolve_overloaded_builtin - handle all the type checking. The result is a complete expression - that implements this function call. */ - tem = resolve_overloaded_builtin (loc, function, params); - if (tem) - return tem; - name = DECL_NAME (function); if (flag_tm) @@ -2864,6 +2856,30 @@ build_function_call_vec (location_t loc, tree function, return require_complete_type (result); } +/* Like build_function_call_vec, but call also resolve_overloaded_builtin. */ + +tree +c_build_function_call_vec (location_t loc, tree function, + vec<tree, va_gc> *params, + vec<tree, va_gc> *origtypes) +{ + /* Strip NON_LVALUE_EXPRs, etc., since we aren't using as an lvalue. */ + STRIP_TYPE_NOPS (function); + + /* Convert anything with function type to a pointer-to-function. */ + if (TREE_CODE (function) == FUNCTION_DECL) + { + /* Implement type-directed function overloading for builtins. + resolve_overloaded_builtin and targetm.resolve_overloaded_builtin + handle all the type checking. The result is a complete expression + that implements this function call. */ + tree tem = resolve_overloaded_builtin (loc, function, params); + if (tem) + return tem; + } + return build_function_call_vec (loc, function, params, origtypes); +} + /* Convert the argument expressions in the vector VALUES to the types in the list TYPELIST. @@ -3629,7 +3645,8 @@ build_unary_op (location_t location, /* Report invalid types. */ if (typecode != POINTER_TYPE && typecode != FIXED_POINT_TYPE - && typecode != INTEGER_TYPE && typecode != REAL_TYPE) + && typecode != INTEGER_TYPE && typecode != REAL_TYPE + && typecode != VECTOR_TYPE) { if (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR) error_at (location, "wrong type argument to increment"); @@ -3694,7 +3711,9 @@ build_unary_op (location_t location, } else { - inc = integer_one_node; + inc = (TREE_CODE (argtype) == VECTOR_TYPE + ? build_one_cst (argtype) + : integer_one_node); inc = convert (argtype, inc); } @@ -4331,8 +4350,10 @@ build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp, { if (int_operands) { - op1 = remove_c_maybe_const_expr (op1); - op2 = remove_c_maybe_const_expr (op2); + /* Use c_fully_fold here, since C_MAYBE_CONST_EXPR might be + nested inside of the expression. */ + op1 = c_fully_fold (op1, false, NULL); + op2 = c_fully_fold (op2, false, NULL); } ret = build3 (COND_EXPR, result_type, ifexp, op1, op2); if (int_operands) @@ -10618,7 +10639,8 @@ c_finish_omp_clauses (tree clauses) "%qE has invalid type for %<reduction%>", t); remove = true; } - else if (FLOAT_TYPE_P (TREE_TYPE (t))) + else if (FLOAT_TYPE_P (TREE_TYPE (t)) + || TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE) { enum tree_code r_code = OMP_CLAUSE_REDUCTION_CODE (c); const char *r_name = NULL; @@ -10628,8 +10650,14 @@ c_finish_omp_clauses (tree clauses) case PLUS_EXPR: case MULT_EXPR: case MINUS_EXPR: + break; case MIN_EXPR: + if (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE) + r_name = "min"; + break; case MAX_EXPR: + if (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE) + r_name = "max"; break; case BIT_AND_EXPR: r_name = "&"; @@ -10641,9 +10669,11 @@ c_finish_omp_clauses (tree clauses) r_name = "|"; break; case TRUTH_ANDIF_EXPR: + if (FLOAT_TYPE_P (TREE_TYPE (t))) r_name = "&&"; break; case TRUTH_ORIF_EXPR: + if (FLOAT_TYPE_P (TREE_TYPE (t))) r_name = "||"; break; default: |