This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/18624] GCC does not detect local variable set but never used



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]