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>
* 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.
......
......@@ -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:
......
......@@ -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:
......
......@@ -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");
}
}
}
......
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