diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-26 18:51:07 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-26 18:51:07 +0000 |
commit | a1d07e97417fb905496f727f3a78b89e2eaf6397 (patch) | |
tree | 6399922f5183f7307326645bf3146bd07174447d | |
parent | 9579733ed5bf9976b201cbe8cc2649ea033987bc (diff) | |
download | gcc-a1d07e97417fb905496f727f3a78b89e2eaf6397.tar.gz |
PR c/39889
* stmt.c (warn_if_unused_value): Look through NON_LVALUE_EXPR.
* gcc.dg/Wunused-value-3.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146811 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/fortran/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/stmt.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/Wunused-value-3.c | 9 |
5 files changed, 30 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 480a6bfac08..6770f231366 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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. diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index d39b7138d24..6c2a442f783 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -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 diff --git a/gcc/stmt.c b/gcc/stmt.c index e2688efadad..6dc32fdfc12 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5faeffcfeb1..7acde8de79e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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> diff --git a/gcc/testsuite/gcc.dg/Wunused-value-3.c b/gcc/testsuite/gcc.dg/Wunused-value-3.c new file mode 100644 index 00000000000..333ddea4ffd --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wunused-value-3.c @@ -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" } */ +} |