public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/21548] New: [4.0 regression] Wrong warning about uninitialized variable
@ 2005-05-13 14:46 schwab at suse dot de
  2005-05-13 14:53 ` [Bug c/21548] " pinskia at gcc dot gnu dot org
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: schwab at suse dot de @ 2005-05-13 14:46 UTC (permalink / raw)
  To: gcc-bugs

$ cat uninit.c 
static int blocksize = 4096; 
 
int bar (int); 
 
void foo (void) 
{ 
  int toread; 
  int bytes; 
  static char eof_reached = 0; 
 
  toread = blocksize; 
 
  while (toread != 0) 
    { 
      bytes = bar (toread); 
      if (bytes <= 0) 
	{ 
	  if (bytes < 0) 
	    continue; 
	  break; 
	} 
      toread -= bytes; 
    } 
 
  if (bytes == 0) 
    eof_reached = 1; 
} 
$ gcc -O2 -Wall -c uninit.c  
uninit.c: In function &#8216;foo&#8217;:  
uninit.c:25: warning: &#8216;bytes&#8217; is used uninitialized in this function  
  
This warning is wrong, since bytes is never used uninitialized as long as  
blocksize is non-zero.

-- 
           Summary: [4.0 regression] Wrong warning about uninitialized
                    variable
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: schwab at suse dot de
                CC: gcc-bugs at gcc dot gnu dot org


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


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

end of thread, other threads:[~2005-09-27 16:19 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-13 14:46 [Bug c/21548] New: [4.0 regression] Wrong warning about uninitialized variable schwab at suse dot de
2005-05-13 14:53 ` [Bug c/21548] " pinskia at gcc dot gnu dot org
2005-05-13 14:55 ` schwab at suse dot de
2005-05-13 14:57 ` rearnsha at gcc dot gnu dot org
2005-05-13 14:59 ` schwab at suse dot de
2005-05-13 15:01 ` pinskia at gcc dot gnu dot org
2005-05-13 15:01 ` schwab at suse dot de
2005-05-13 15:05 ` rearnsha at gcc dot gnu dot org
2005-05-13 15:06 ` schwab at suse dot de
2005-05-13 21:54 ` [Bug tree-optimization/21548] " pinskia at gcc dot gnu dot org
2005-05-13 22:14 ` pinskia at gcc dot gnu dot org
2005-05-13 22:16 ` pinskia at gcc dot gnu dot org
2005-05-13 22:23 ` pinskia at gcc dot gnu dot org
2005-05-13 22:44 ` pinskia at gcc dot gnu dot org
2005-07-08  1:37 ` mmitchel at gcc dot gnu dot org
2005-08-22 12:35 ` pinskia at gcc dot gnu dot org
2005-09-27 16:23 ` mmitchel 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).