This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/44677] New: Warn for variables incremented but not used
- From: "jsm28 at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Jun 2010 00:53:13 -0000
- Subject: [Bug c/44677] New: Warn for variables incremented but not used
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
void
f (void)
{
int i;
i = 0;
i++;
}
seems like something a natural generalization of -Wunused-but-set-variable
should warn for; the value of i is only used as part of an increment of i,
so the definition and all uses of this variable could be safely removed.
For a real example of this, see the variable lang_n_infiles in
gcc.c:process_command (I'm testing a patch that removes that variable
along with other changes).
--
Summary: Warn for variables incremented but not used
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jsm28 at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44677