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
This commit is contained in:
parent
fd3e0a33c7
commit
f1a89dd00c
|
@ -1,3 +1,9 @@
|
|||
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
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
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.
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
/* 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; });
|
||||
}
|
Loading…
Reference in New Issue