This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/18624] GCC does not detect local variable set but never used
- 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: 25 Nov 2009 18:28:33 -0000
- Subject: [Bug c/18624] GCC does not detect local variable set but never used
- References: <bug-18624-9596@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #20 from jakub at gcc dot gnu dot org 2009-11-25 18:28 -------
That's on purpose. b is actually used by assignment to a in both cases, c is
used in the first case by assignment to b. If the user decides to remove the a
variable (resp. c in the second case) based on this warning, he'll get further
warnings and can tweak it, but not counting references assigned to variables
warned about is neither possible in this implementation (you don't know until
the end whether something is going to be just set and not used) nor desirable
(in some cases you don't want to fix code by removing the set but not used
variable, but instead actually use it somewhere, and in that case you could be
removing the other set but not used vars even when they are now actually used
by some used variable).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18624