aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1993-04-13 20:29:47 +0000
committerRichard Stallman <rms@gnu.org>1993-04-13 20:29:47 +0000
commit0b1dffa7f1351a87825d01136ed64575f3b0aae5 (patch)
treeb2ad321208d7852c293d24a91621812eb145debf
parent9a63e81decd44e0dbd794dc9dee22ee34302858a (diff)
downloadgcc-0b1dffa7f1351a87825d01136ed64575f3b0aae5.zip
gcc-0b1dffa7f1351a87825d01136ed64575f3b0aae5.tar.gz
gcc-0b1dffa7f1351a87825d01136ed64575f3b0aae5.tar.bz2
(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
-rw-r--r--gcc/c-typeck.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index d7745e3..f809b35 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);
});