Subject: uninitialized(?) variable in UVM
To: None <current-users@netbsd.org>
From: Todd Whitesel <toddpw@best.com>
List: current-users
Date: 10/18/1998 08:42:00
While trying to isolate a kernel panic on arm32, I rebuilt a kernel with -O
instead of -O2, and lookie here:

cc  -O -Werror -Wall -I. -I../../../../arch -I../../../.. -nostdinc -DFOOTBRIDGE -DEBSA285 -DSYSVMSG -DSYSVSEM -DSYSVSHM -DSHMMAXPGS="0x400" -DMEMORY_DISK_HOOKS -DPMAP_STATIC_L1S="0x80" -DDIAGNOSTIC -DPOSTMORTEM -DMAXUSERS=8 -D_KERNEL  -Darm32 -Wcomment  -c ../../../../uvm/uvm_aobj.c
cc1: warnings being treated as errors
../../../../uvm/uvm_aobj.c: In function `uao_get':
../../../../uvm/uvm_aobj.c:758: warning: `ptmp' might be used uninitialized in this function
*** Error code 1

Stop.


Pasting the compile lines into an xterm confirm that -O2 masks the warning.

Moving right along:

cc  -O -Werror -Wall -I. -I../../../../arch -I../../../.. -nostdinc -DFOOTBRIDGE -DEBSA285 -DSYSVMSG -DSYSVSEM -DSYSVSHM -DSHMMAXPGS="0x400" -DMEMORY_DISK_HOOKS -DPMAP_STATIC_L1S="0x80" -DDIAGNOSTIC -DPOSTMORTEM -DMAXUSERS=8 -D_KERNEL  -Darm32 -Wcomment  -c ../../../../uvm/uvm_km.c
cc1: warnings being treated as errors
../../../../uvm/uvm_km.c: In function `uvm_km_get':
../../../../uvm/uvm_km.c:211: warning: `ptmp' might be used uninitialized in this function
*** Error code 1

Stop.


Same story, going back to -O2 makes it work.

It's probably a case of gcc being paranoid, but on the off chance that it
is actually a bug, I figured I should say something.

Todd Whitesel
toddpw @ best.com