Bugzilla – Bug 155947
netdiag-20010114-397: local variable used before set
Last modified: 2006-03-16 13:28:58 UTC
I just tried to compile package netdiag-20010114-397 with the Intel C compiler. It said tulip-diag.c(891): warning #592: variable "sum" is used before its value is set The source code is u_int16_t sum; outl(0x600 | i, ioaddr + 0x98); do value = inl(ioaddr + CSR9); while (value < 0 && --boguscnt > 0); ((u_int16_t *)eeprom_contents)[i] = value; sum += value & 0xffff; I agree with the compiler. Suggest initialise local variable "sum" before first use.
the sum variable is only used inside this loop. gcc doesnt warn about it as it eliminates this variable in the optimizer. the gcc warnings for uninitialized variables are emitted after this optimization step. the real fix might be removing the declaration of sum and the one line where it is used. but i would ask upstream about this suggestion first. i dont think it is worth fixing a "non" bug.