Commit f1a89dd0 by Jakub Jelinek Committed by Jakub Jelinek

re PR c/50179 (wrong "set but not used" warning)

	PR c/50179
	* c-typeck.c (c_process_expr_stmt): Skip over nops and
	call mark_exp_read even if exprv is ADDR_EXPR.

	* c-c++-common/Wunused-var-14.c: New test.

From-SVN: r178110
parent fd3e0a33
2011-08-26 Jakub Jelinek <jakub@redhat.com>
PR c/50179
* c-typeck.c (c_process_expr_stmt): Skip over nops and
call mark_exp_read even if exprv is ADDR_EXPR.
2011-08-26 Richard Sandiford <richard.sandiford@linaro.org>
* df-problems.c (df_note_bb_compute): Pass uses rather than defs
......
......@@ -9109,7 +9109,11 @@ c_process_expr_stmt (location_t loc, tree expr)
exprv = expr;
while (TREE_CODE (exprv) == COMPOUND_EXPR)
exprv = TREE_OPERAND (exprv, 1);
if (DECL_P (exprv) || handled_component_p (exprv))
while (CONVERT_EXPR_P (exprv))
exprv = TREE_OPERAND (exprv, 0);
if (DECL_P (exprv)
|| handled_component_p (exprv)
|| TREE_CODE (exprv) == ADDR_EXPR)
mark_exp_read (exprv);
/* If the expression is not of a type to which we cannot assign a line
......
2011-08-26 Jakub Jelinek <jakub@redhat.com>
PR c/50179
* c-c++-common/Wunused-var-14.c: New test.
2011-08-26 Tom de Vries <tom@codesourcery.com>
* gcc.dg/tree-ssa/ivopts-lt.c: New test.
......
/* PR c/50179 */
/* { dg-options "-Wunused" } */
/* { dg-do compile } */
void bar (int, ...);
char *
foo (void)
{
bar (1, (__extension__ ({ static char b[2]; b[0] = 1; b; })));
bar (1, ({ static char c[2]; c[0] = 1; c; }));
return ({ static char d[2]; d[0] = 1; d; });
}
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