aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2010-06-07 19:49:06 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2010-06-07 19:49:06 +0200
commit026698d28e6eac591edfc8b1fd397e73b0503c56 (patch)
tree9683a15333492961769147bbff3993b18d63fafa /gcc/cp
parent75522f217e551de6b210c2c2e963a8386344ae99 (diff)
downloadgcc-026698d28e6eac591edfc8b1fd397e73b0503c56.zip
gcc-026698d28e6eac591edfc8b1fd397e73b0503c56.tar.gz
gcc-026698d28e6eac591edfc8b1fd397e73b0503c56.tar.bz2
re PR c++/44443 (-Wunused-but-set-variable problem with unused attribute on type)
PR c++/44443 * decl.c (initialize_local_var): If TREE_USED is set on the type, set also DECL_READ_P on the decl. * c-c++-common/Wunused-var-11.c: New test. From-SVN: r160387
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c2
2 files changed, 8 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 6e4c35e..622a793 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2010-06-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/44443
+ * decl.c (initialize_local_var): If TREE_USED is set on the type,
+ set also DECL_READ_P on the decl.
+
2010-05-25 Dodji Seketeli <dodji@redhat.com>
PR c++/44188
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index c9f864a..171e160 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5508,6 +5508,8 @@ initialize_local_var (tree decl, tree init)
/* Compute and store the initial value. */
already_used = TREE_USED (decl) || TREE_USED (type);
+ if (TREE_USED (type))
+ DECL_READ_P (decl) = 1;
/* Generate a cleanup, if necessary. */
cleanup = cxx_maybe_build_cleanup (decl);