diff options
Diffstat (limited to 'gcc/c-typeck.c')
-rw-r--r-- | gcc/c-typeck.c | 73 |
1 files changed, 57 insertions, 16 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 4a804389ce1..17e314489ea 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -752,7 +752,7 @@ c_sizeof (type) TYPE_IS_SIZETYPE means that certain things (like overflow) will never happen. However, this node should really have type `size_t', which is just a typedef for an ordinary integer type. */ - return fold (build1 (NOP_EXPR, c_size_type_node, size)); + return fold (build1 (NOP_EXPR, size_type_node, size)); } tree @@ -776,7 +776,7 @@ c_sizeof_nowarn (type) TYPE_IS_SIZETYPE means that certain things (like overflow) will never happen. However, this node should really have type `size_t', which is just a typedef for an ordinary integer type. */ - return fold (build1 (NOP_EXPR, c_size_type_node, size)); + return fold (build1 (NOP_EXPR, size_type_node, size)); } /* Compute the size to increment a pointer by. */ @@ -1493,7 +1493,8 @@ build_external_ref (id, fun) if (TREE_TYPE (ref) == error_mark_node) return error_mark_node; - assemble_external (ref); + if (!skip_evaluation) + assemble_external (ref); TREE_USED (ref) = 1; if (TREE_CODE (ref) == CONST_DECL) @@ -2887,9 +2888,6 @@ build_unary_op (code, xarg, flag) tree inc; tree result_type = TREE_TYPE (arg); - arg = get_unwidened (arg, 0); - argtype = TREE_TYPE (arg); - /* Compute the increment. */ if (typecode == POINTER_TYPE) @@ -2918,6 +2916,9 @@ build_unary_op (code, xarg, flag) else inc = integer_one_node; + arg = get_unwidened (arg, 0); + argtype = TREE_TYPE (arg); + inc = convert (argtype, inc); /* Handle incrementing a cast-expression. */ @@ -4280,6 +4281,30 @@ convert_for_assignment (type, rhs, errtype, fundecl, funname, parmnum) return error_mark_node; } +/* Convert VALUE for assignment into inlined parameter PARM. */ + +tree +c_convert_parm_for_inlining (parm, value, fn) + tree parm, value, fn; +{ + tree ret, type; + + /* If FN was prototyped, the value has been converted already + in convert_arguments. */ + if (! value || TYPE_ARG_TYPES (TREE_TYPE (fn))) + return value; + + type = TREE_TYPE (parm); + ret = convert_for_assignment (type, value, + (char *) 0 /* arg passing */, fn, + DECL_NAME (fn), 0); + if (PROMOTE_PROTOTYPES + && INTEGRAL_TYPE_P (type) + && (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))) + ret = default_conversion (ret); + return ret; +} + /* Print a warning using MSGID. It gets OPNAME as its one parameter. If OPNAME is null, it is replaced by "passing arg ARGNUM of `FUNCTION'". @@ -6575,6 +6600,16 @@ process_init_element (value) fieldtype = TYPE_MAIN_VARIANT (fieldtype); fieldcode = TREE_CODE (fieldtype); + /* Error for non-static initialization of a flexible array member. */ + if (fieldcode == ARRAY_TYPE + && !require_constant_value + && TYPE_SIZE (fieldtype) == NULL_TREE + && TREE_CHAIN (constructor_fields) == NULL_TREE) + { + error_init ("non-static initialization of a flexible array member"); + break; + } + /* Accept a string constant to initialize a subarray. */ if (value != 0 && fieldcode == ARRAY_TYPE @@ -6610,13 +6645,18 @@ process_init_element (value) bit_position (constructor_fields), DECL_SIZE (constructor_fields)); - constructor_unfilled_fields = TREE_CHAIN (constructor_fields); - /* Skip any nameless bit fields. */ - while (constructor_unfilled_fields != 0 - && DECL_C_BIT_FIELD (constructor_unfilled_fields) - && DECL_NAME (constructor_unfilled_fields) == 0) - constructor_unfilled_fields = - TREE_CHAIN (constructor_unfilled_fields); + /* If the current field was the first one not yet written out, + it isn't now, so update. */ + if (constructor_unfilled_fields == constructor_fields) + { + constructor_unfilled_fields = TREE_CHAIN (constructor_fields); + /* Skip any nameless bit fields. */ + while (constructor_unfilled_fields != 0 + && DECL_C_BIT_FIELD (constructor_unfilled_fields) + && DECL_NAME (constructor_unfilled_fields) == 0) + constructor_unfilled_fields = + TREE_CHAIN (constructor_unfilled_fields); + } } constructor_fields = TREE_CHAIN (constructor_fields); @@ -6851,9 +6891,10 @@ simple_asm_stmt (expr) if (TREE_CHAIN (expr)) expr = combine_strings (expr); - stmt = add_stmt (build_stmt (ASM_STMT, NULL_TREE, expr, - NULL_TREE, NULL_TREE, - NULL_TREE)); + + /* Simple asm statements are treated as volatile. */ + stmt = add_stmt (build_stmt (ASM_STMT, ridpointers[(int) RID_VOLATILE], + expr, NULL_TREE, NULL_TREE, NULL_TREE)); ASM_INPUT_P (stmt) = 1; return stmt; } |