public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/44677]  New: Warn for variables incremented but not used
@ 2010-06-26  0:53 jsm28 at gcc dot gnu dot org
  2010-06-28  0:35 ` [Bug c/44677] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 9+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2010-06-26  0:53 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-07-18 22:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-44677-4@http.gcc.gnu.org/bugzilla/>
2020-05-19 17:23 ` [Bug c/44677] Warn for variables incremented but not used msebor at gcc dot gnu.org
2021-04-21 17:41 ` jsm28 at gcc dot gnu.org
2021-10-24  6:09 ` pinskia at gcc dot gnu.org
2022-04-09  0:48 ` eggert at cs dot ucla.edu
2022-09-19 10:03 ` stormbyte at gmail dot com
2022-12-17 17:58 ` pinskia at gcc dot gnu.org
2022-12-17 18:04 ` [Bug c/44677] Warn for variables incremented but not used (+=, ++) pinskia at gcc dot gnu.org
2023-07-18 22:59 ` vincent-gcc at vinc17 dot net
2010-06-26  0:53 [Bug c/44677] New: Warn for variables incremented but not used jsm28 at gcc dot gnu dot org
2010-06-28  0:35 ` [Bug c/44677] " pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).