On 20 Oct 2022 09:32, Tsukasa OI wrote: > GCC generates a warning if a variable may be used uninitialized on some > cases ("-Wmaybe-uninitialized"). Despite that GCC will not cause a build > failure even when "--enable-werror" is specified, it would be nice to get > rid of it. > > This commit initializes variables "reg" and "control_nr" when declared. > --- > sim/ppc/hw_ide.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > --- a/sim/ppc/hw_ide.c > +++ b/sim/ppc/hw_ide.c > @@ -729,8 +729,8 @@ hw_ide_io_read_buffer(device *me, > unsigned_word cia) > { > hw_ide_device *ide = (hw_ide_device *)device_data(me); > - int control_nr; > - int reg; > + int control_nr = 0; > + int reg = 0; > ide_controller *controller; > > /* find the interface */ > @@ -783,8 +783,8 @@ hw_ide_io_write_buffer(device *me, > unsigned_word cia) > { > hw_ide_device *ide = (hw_ide_device *)device_data(me); > - int control_nr; > - int reg; > + int control_nr = 0; > + int reg = 0; > ide_controller *controller; > > /* find the interface */ afaict, this is a false positive. these two vars are initialized by the decode_address call, and if it's unable to, it calls device_error which is supposed to be marked NORETURN. what if we change decode_address to initialize both output variables and leave a comment there explaining why. -mike