Commit 026698d2 by Jakub Jelinek Committed by Jakub Jelinek

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
parent 75522f21
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
......
......@@ -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);
......
2010-06-07 Jakub Jelinek <jakub@redhat.com>
PR c++/44443
* c-c++-common/Wunused-var-11.c: New test.
2010-06-07 Jan Hubicka <jh@suse.cz>
* gcc.dg/ipa/pure-const-1.c: New testcase.
......
/* PR c++/44443 */
/* { dg-options "-Wunused" } */
/* { dg-do compile } */
int i;
void
f1 ()
{
const int * __attribute__((unused)) a = &i;
const int *b __attribute__((unused)) = &i;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment