From: Richard Stallman Date: Tue, 13 Apr 1993 20:29:47 +0000 (+0000) Subject: (digest_init): Don't call default_conversion before convert_for_assignment. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0b1dffa7f1351a87825d01136ed64575f3b0aae5;p=gcc.git (digest_init): Don't call default_conversion before convert_for_assignment. (parser_build_binary_op): Make NOP_EXPR, not NON_LVALUE_EXPR. From-SVN: r4129 --- diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index d7745e3abf0..f809b358ae9 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -2218,7 +2218,10 @@ parser_build_binary_op (code, arg1, arg2) else { int flag = TREE_CONSTANT (result); - result = build1 (NON_LVALUE_EXPR, TREE_TYPE (result), result); + /* We use NOP_EXPR rather than NON_LVALUE_EXPR + so that convert_for_assignment won't strip it. + That way, we get warnings for things like p = (1 - 1). */ + result = build1 (NOP_EXPR, TREE_TYPE (result), result); C_SET_EXP_ORIGINAL_CODE (result, code); TREE_CONSTANT (result) = flag; } @@ -5011,11 +5014,13 @@ digest_init (type, init, tail, require_constant, constructor_constant, ofwhat) ({ if (ofwhat) push_string (ofwhat); + if (!raw_constructor) + inside_init = init; + /* Note that convert_for_assignment calls default_conversion + for arrays and functions. We must not call it in the + case where inside_init is a null pointer constant. */ inside_init - = convert_for_assignment (type, - default_conversion (raw_constructor - ? inside_init - : init), + = convert_for_assignment (type, inside_init, &initialization_message, NULL_TREE, NULL_TREE, 0); });