Subject: Re: elink3 bites (was Re: new i386 snapshot (finally))
To: Simon J. Gerraty <sjg@quick.com.au>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: port-i386
Date: 07/12/1997 22:27:42
 >root:13# rm elink3.o 
 >root:14# make COPTS=-O

 >../../../../dev/ic/elink3.c: In function `epbusyeeprom':
 >../../../../dev/ic/elink3.c:1582: warning: `j' might be used uninitialized in th
 >is function
 >*** Error code 1
 >
 >Stop.


Well the errror message did say ``might be unused''. This is normal.
GCC's warnings aren't always accurate and it doesn't always propagate
information about constants through loops, or down  both sides
of an if-then-else. 

You can get warnings about an uninitialized variable from

	if (...) {
		j = 1;
	else {
		j = 0;
	}

	/*  .. first use of j's rvalue */

If it's buried in enough surronding code; and I think also from
switches that actually set j in every branch.

It worth explicitly initializing j to shut up GCC in this case?
CGD argues no, they are not kernel errors, they are erroneous compiler
warnings, and turns off these warnings in the Alpha port's Makefile.


 >Trying COPTS= (ie no optimization), results in dozens of warnings
 >about foo defined but not used.

GCC's warnings about variable used before defined, or defined but not
used, depend upon dataflow (ud and du) information gathered for
optimization purposes.  If you compile without optimization enabled,
GCC never builds the data-flow information.  If you then ask for
warnings about unused or unittialized variables, you get spurious
warnings.  This is (or used to be) noted in the GCC documentation.