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; 2+ 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] 2+ messages in thread

* [Bug c/44677] Warn for variables incremented but not used
  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 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-06-28  0:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2010-06-28 00:34 -------
Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2010-06-28 00:34:58
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44677


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

end of thread, other threads:[~2010-06-28  0:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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).