re PR c/39889 (Bogus -Wunused-value warning)

PR c/39889
	* stmt.c (warn_if_unused_value): Look through NON_LVALUE_EXPR.

	* gcc.dg/Wunused-value-3.c: New test.

From-SVN: r146811
This commit is contained in:
Jakub Jelinek 2009-04-26 20:51:07 +02:00 committed by Jakub Jelinek
parent 77f2a97066
commit 92061771a2
5 changed files with 30 additions and 10 deletions

View File

@ -1,4 +1,9 @@
2009-04-22 Jakub Jelinek <jakub@redhat.com>
2009-04-26 Jakub Jelinek <jakub@redhat.com>
PR c/39889
* stmt.c (warn_if_unused_value): Look through NON_LVALUE_EXPR.
2009-04-26 Jakub Jelinek <jakub@redhat.com>
* tree-nested.c (get_nonlocal_vla_type): If not optimizing, call
note_nonlocal_vla_type for nonlocal VLAs.

View File

@ -1,3 +1,15 @@
2009-04-26 Jakub Jelinek <jakub@redhat.com>
* trans-decl.c: Include pointer-set.h.
(nonlocal_dummy_decl_pset, tree nonlocal_dummy_decls): New variables.
(gfc_nonlocal_dummy_array_decl): New function.
(gfc_get_symbol_decl): Call it for non-local dummy args with saved
descriptor.
(gfc_get_symbol_decl): Set DECL_BY_REFERENCE when needed.
(gfc_generate_function_code): Initialize nonlocal_dummy_decl{s,_pset},
chain it to outermost block's vars, destroy it afterwards.
* Make-lang.in (trans-decl.o): Depend on pointer-set.h.
2009-04-25 Janus Weil <janus@gcc.gnu.org>
PR fortran/39688

View File

@ -1418,6 +1418,7 @@ warn_if_unused_value (const_tree exp, location_t locus)
goto restart;
case SAVE_EXPR:
case NON_LVALUE_EXPR:
exp = TREE_OPERAND (exp, 0);
goto restart;

View File

@ -1,14 +1,7 @@
2009-04-26 Jakub Jelinek <jakub@redhat.com>
* trans-decl.c: Include pointer-set.h.
(nonlocal_dummy_decl_pset, tree nonlocal_dummy_decls): New variables.
(gfc_nonlocal_dummy_array_decl): New function.
(gfc_get_symbol_decl): Call it for non-local dummy args with saved
descriptor.
(gfc_get_symbol_decl): Set DECL_BY_REFERENCE when needed.
(gfc_generate_function_code): Initialize nonlocal_dummy_decl{s,_pset},
chain it to outermost block's vars, destroy it afterwards.
* Make-lang.in (trans-decl.o): Depend on pointer-set.h.
PR c/39889
* gcc.dg/Wunused-value-3.c: New test.
2009-04-26 Joseph Myers <joseph@codesourcery.com>

View File

@ -0,0 +1,9 @@
/* PR c/39889 */
/* { dg-do compile } */
/* { dg-options "-Wunused-value" } */
int x;
int foo (void)
{
return (1 ? x = 0 : (void) 0), 0; /* { dg-bogus "value computed is not used" } */
}