From: Jason Merrill Date: Thu, 13 Aug 1998 16:12:55 +0000 (-0400) Subject: expr.c (safe_from_p): Change code to ERROR_MARK only when not accessing nodes. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ff59bfe6b2ea13d9bb6171a43a5957e03a73901f;p=gcc.git expr.c (safe_from_p): Change code to ERROR_MARK only when not accessing nodes. * expr.c (safe_from_p): Change code to ERROR_MARK only when not accessing nodes. * toplev.c (display_help): Add braces to shut up warnings. * fold-const.c (non_lvalue): Don't deal with null pointer constants here. (fold, case COMPOUND_EXPR): Wrap a constant 0 in a NOP_EXPR. From-SVN: r21698 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 35e2e6cd909..9c33025ce64 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,16 @@ +Thu Aug 13 16:09:53 1998 Martin von Loewis + + * expr.c (safe_from_p): Change code to ERROR_MARK only when not + accessing nodes. + Thu Aug 13 15:24:48 1998 Jason Merrill + * toplev.c (display_help): Add braces to shut up warnings. + + * fold-const.c (non_lvalue): Don't deal with null pointer + constants here. + (fold, case COMPOUND_EXPR): Wrap a constant 0 in a NOP_EXPR. + * c-typeck.c (initializer_constant_valid_p): Allow conversion of 0 of any size to a pointer. diff --git a/gcc/expr.c b/gcc/expr.c index 208db5cb2d8..7f1b35f859e 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -4983,13 +4983,19 @@ safe_from_p (x, exp, top_p) if (save_expr_count >= save_expr_size) return 0; save_expr_rewritten[save_expr_count++] = exp; - TREE_SET_CODE (exp, ERROR_MARK); nops = tree_code_length[(int) SAVE_EXPR]; for (i = 0; i < nops; i++) - if (TREE_OPERAND (exp, i) != 0 - && ! safe_from_p (x, TREE_OPERAND (exp, i), 0)) - return 0; + { + tree operand = TREE_OPERAND (exp, i); + if (operand == NULL_TREE) + continue; + TREE_SET_CODE (exp, ERROR_MARK); + if (!safe_from_p (x, operand, 0)) + return 0; + TREE_SET_CODE (exp, SAVE_EXPR); + } + TREE_SET_CODE (exp, ERROR_MARK); return 1; case BIND_EXPR: diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 4fe68994454..c84d52c9724 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -1679,8 +1679,7 @@ fold_convert (t, arg1) return t; } -/* Return an expr equal to X but certainly not valid as an lvalue. - Also make sure it is not valid as an null pointer constant. */ +/* Return an expr equal to X but certainly not valid as an lvalue. */ tree non_lvalue (x) @@ -1694,18 +1693,7 @@ non_lvalue (x) || TREE_CODE (x) == REAL_CST || TREE_CODE (x) == STRING_CST || TREE_CODE (x) == ADDR_EXPR) - { - if (TREE_CODE (x) == INTEGER_CST && integer_zerop (x)) - { - /* Use NOP_EXPR instead of NON_LVALUE_EXPR - so convert_for_assignment won't strip it. - This is so this 0 won't be treated as a null pointer constant. */ - result = build1 (NOP_EXPR, TREE_TYPE (x), x); - TREE_CONSTANT (result) = TREE_CONSTANT (x); - return result; - } - return x; - } + return x; result = build1 (NON_LVALUE_EXPR, TREE_TYPE (x), x); TREE_CONSTANT (result) = TREE_CONSTANT (x); @@ -6060,7 +6048,7 @@ fold (expr) return t; /* Don't let (0, 0) be null pointer constant. */ if (integer_zerop (arg1)) - return non_lvalue (arg1); + return build1 (NOP_EXPR, TREE_TYPE (arg1), arg1); return arg1; case COMPLEX_EXPR: diff --git a/gcc/toplev.c b/gcc/toplev.c index 9ab6435ab30..63e85aa3a83 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -4094,10 +4094,12 @@ display_help () } #endif if (undoc) - if (doc) - printf ("\nThere are undocumented target specific options as well.\n"); - else - printf (" They exist, but they are not documented.\n"); + { + if (doc) + printf ("\nThere are undocumented target specific options as well.\n"); + else + printf (" They exist, but they are not documented.\n"); + } } }