diff options
author | Jakub Jelinek <jakub@redhat.com> | 2010-06-07 19:50:10 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2010-06-07 19:50:10 +0200 |
commit | d84686d14a6df2fbfe72830c1f6dc7456cca751e (patch) | |
tree | 6bf1acdbbbfd98a7996cc0ee8d991ab35560999a /gcc/cp | |
parent | 026698d28e6eac591edfc8b1fd397e73b0503c56 (diff) | |
download | gcc-d84686d14a6df2fbfe72830c1f6dc7456cca751e.zip gcc-d84686d14a6df2fbfe72830c1f6dc7456cca751e.tar.gz gcc-d84686d14a6df2fbfe72830c1f6dc7456cca751e.tar.bz2 |
re PR c++/44444 (-Wunused-but-set-variable problem with field references)
PR c++/44444
* expr.c (mark_exp_read): Handle INDIRECT_REF.
* cvt.c (convert_to_void): Handle INDIRECT_REF like
handled_component_p.
* g++.dg/warn/Wunused-var-12.C: New test.
From-SVN: r160388
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/cvt.c | 4 | ||||
-rw-r--r-- | gcc/cp/expr.c | 3 |
3 files changed, 10 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 622a793..3bfd7f1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2010-06-07 Jakub Jelinek <jakub@redhat.com> + PR c++/44444 + * expr.c (mark_exp_read): Handle INDIRECT_REF. + * cvt.c (convert_to_void): Handle INDIRECT_REF like + handled_component_p. + PR c++/44443 * decl.c (initialize_local_var): If TREE_USED is set on the type, set also DECL_READ_P on the decl. diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 4aee151..04c068c 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -834,7 +834,9 @@ convert_to_void (tree expr, const char *implicit, tsubst_flags_t complain) while (TREE_CODE (exprv) == COMPOUND_EXPR) exprv = TREE_OPERAND (exprv, 1); - if (DECL_P (exprv) || handled_component_p (exprv)) + if (DECL_P (exprv) + || handled_component_p (exprv) + || TREE_CODE (exprv) == INDIRECT_REF) /* Expr is not being 'used' here, otherwise we whould have called mark_{rl}value_use use here, which would have in turn called mark_exp_read. Rather, we call mark_exp_read directly diff --git a/gcc/cp/expr.c b/gcc/cp/expr.c index ef5d6be..0a0ba53 100644 --- a/gcc/cp/expr.c +++ b/gcc/cp/expr.c @@ -1,7 +1,7 @@ /* Convert language-specific tree expression to rtl instructions, for GNU compiler. Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 2000, 2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc. + 2000, 2001, 2002, 2003, 2004, 2007, 2010 Free Software Foundation, Inc. This file is part of GCC. @@ -132,6 +132,7 @@ mark_exp_read (tree exp) case IMAGPART_EXPR: CASE_CONVERT: case ADDR_EXPR: + case INDIRECT_REF: mark_exp_read (TREE_OPERAND (exp, 0)); break; case COMPOUND_EXPR: |