This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Spurious uninitialized warnings in egcs 1.1 over gcc 2.8.1
- To: egcs at cygnus dot com
- Subject: Spurious uninitialized warnings in egcs 1.1 over gcc 2.8.1
- From: George <greerga at entropy dot muc dot muohio dot edu>
- Date: Thu, 3 Sep 1998 17:45:35 -0400 (EDT)
Trivial reduced test program:
Compiled as such:
gcc -c -g -O2 -Wall -Werror test.c
Where:
Reading specs from /usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.57/specs
gcc version egcs-2.91.57 19980901 (egcs-1.1 release)
--------------
#include <stdio.h>
char buf1[8192], buf2[8192];
int main(int argc, char *argv[])
{
char *prefix;
switch (argc) {
case 1: prefix = __FILE__; break;
case 2: prefix = __FILE__; break;
default:
exit(1);
break;
}
#if 1 /* 1 = warning, 0 = no warning */
while (*buf1 != '$')
#endif
sprintf(buf2, "%s%s", prefix, buf1);
return 1;
}
I think it's pretty obvious to people that it won't ever be uninitialized.
In fact, remove the while() and the compiler realizes it too. Removing
the extra 'break;' doesn't change the warning.
Otherwise, great work. :)
-George