Commit ff59bfe6 by Jason Merrill

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
parent 0d906a5f
Thu Aug 13 16:09:53 1998 Martin von Loewis <loewis@informatik.hu-berlin.de>
* expr.c (safe_from_p): Change code to ERROR_MARK only when not
accessing nodes.
Thu Aug 13 15:24:48 1998 Jason Merrill <jason@yorick.cygnus.com> Thu Aug 13 15:24:48 1998 Jason Merrill <jason@yorick.cygnus.com>
* 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 * c-typeck.c (initializer_constant_valid_p): Allow conversion of 0
of any size to a pointer. of any size to a pointer.
......
...@@ -4983,13 +4983,19 @@ safe_from_p (x, exp, top_p) ...@@ -4983,13 +4983,19 @@ safe_from_p (x, exp, top_p)
if (save_expr_count >= save_expr_size) if (save_expr_count >= save_expr_size)
return 0; return 0;
save_expr_rewritten[save_expr_count++] = exp; save_expr_rewritten[save_expr_count++] = exp;
TREE_SET_CODE (exp, ERROR_MARK);
nops = tree_code_length[(int) SAVE_EXPR]; nops = tree_code_length[(int) SAVE_EXPR];
for (i = 0; i < nops; i++) for (i = 0; i < nops; i++)
if (TREE_OPERAND (exp, i) != 0 {
&& ! safe_from_p (x, TREE_OPERAND (exp, i), 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; return 0;
TREE_SET_CODE (exp, SAVE_EXPR);
}
TREE_SET_CODE (exp, ERROR_MARK);
return 1; return 1;
case BIND_EXPR: case BIND_EXPR:
......
...@@ -1679,8 +1679,7 @@ fold_convert (t, arg1) ...@@ -1679,8 +1679,7 @@ fold_convert (t, arg1)
return t; return t;
} }
/* Return an expr equal to X but certainly not valid as an lvalue. /* 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. */
tree tree
non_lvalue (x) non_lvalue (x)
...@@ -1694,18 +1693,7 @@ non_lvalue (x) ...@@ -1694,18 +1693,7 @@ non_lvalue (x)
|| TREE_CODE (x) == REAL_CST || TREE_CODE (x) == REAL_CST
|| TREE_CODE (x) == STRING_CST || TREE_CODE (x) == STRING_CST
|| TREE_CODE (x) == ADDR_EXPR) || 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); result = build1 (NON_LVALUE_EXPR, TREE_TYPE (x), x);
TREE_CONSTANT (result) = TREE_CONSTANT (x); TREE_CONSTANT (result) = TREE_CONSTANT (x);
...@@ -6060,7 +6048,7 @@ fold (expr) ...@@ -6060,7 +6048,7 @@ fold (expr)
return t; return t;
/* Don't let (0, 0) be null pointer constant. */ /* Don't let (0, 0) be null pointer constant. */
if (integer_zerop (arg1)) if (integer_zerop (arg1))
return non_lvalue (arg1); return build1 (NOP_EXPR, TREE_TYPE (arg1), arg1);
return arg1; return arg1;
case COMPLEX_EXPR: case COMPLEX_EXPR:
......
...@@ -4094,11 +4094,13 @@ display_help () ...@@ -4094,11 +4094,13 @@ display_help ()
} }
#endif #endif
if (undoc) if (undoc)
{
if (doc) if (doc)
printf ("\nThere are undocumented target specific options as well.\n"); printf ("\nThere are undocumented target specific options as well.\n");
else else
printf (" They exist, but they are not documented.\n"); printf (" They exist, but they are not documented.\n");
} }
}
} }
/* Compare the user specified 'option' with the language /* Compare the user specified 'option' with the language
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment