Spurious uninitialized warnings in egcs 1.1 over gcc 2.8.1

George greerga@entropy.muc.muohio.edu
Fri Sep 4 01:43:00 GMT 1998

Trivial reduced test program:

Compiled as such:
gcc -c -g -O2 -Wall -Werror test.c

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;

#if 1           /* 1 = warning, 0 = no warning */
  while (*buf1 != '$')
    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. :)


More information about the Gcc mailing list