This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/44108] [4.6 Regression] -Wunused-but-set-variable does not consider array sizing use of a const variable
- From: "jakub at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 May 2010 07:25:18 -0000
- Subject: [Bug c++/44108] [4.6 Regression] -Wunused-but-set-variable does not consider array sizing use of a const variable
- References: <bug-44108-17071@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from jakub at gcc dot gnu dot org 2010-05-14 07:25 -------
Perhaps we just shouldn't ever warn for TREE_CONSTANT decls with
-Wunused-but-set-* ?
Such variables can't be ever set (the set is just the definition),
therefore all sets of TREE_USED for them are reads.
That said, it would be good to find out why we don't warn in that
case; for [M_CONST + 6] we do warn.
Or for DECL_INTEGRAL_CONSTANT_VAR_P decls, or for decls for which
integral_constant_value (decl) != decl not sure what is best.
In any case, compute_array_index_type (and probably many other spots)
calls integral_constant_value and thus
doesn't see the passed in decl anymore afterwards.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44108