qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 03/12] eepro100: initialize a variable in all ca


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH 03/12] eepro100: initialize a variable in all cases
Date: Mon, 11 Oct 2010 19:00:31 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Stefan Weil <address@hidden> writes:

> Am 11.10.2010 16:53, schrieb Markus Armbruster:
>> Blue Swirl <address@hidden> writes:
>>
>>> Compiling with GCC 4.6.0 20100925 produced warnings:
>>> /src/qemu/hw/eepro100.c: In function 'eepro100_read4':
>>> /src/qemu/hw/eepro100.c:1351:14: error: 'val' may be used
>>> uninitialized in this function [-Werror=uninitialized]
>>> /src/qemu/hw/eepro100.c: In function 'eepro100_read2':
>>> /src/qemu/hw/eepro100.c:1328:14: error: 'val' may be used
>>> uninitialized in this function [-Werror=uninitialized]
>>> /src/qemu/hw/eepro100.c: In function 'eepro100_read1':
>>> /src/qemu/hw/eepro100.c:1285:13: error: 'val' may be used
>>> uninitialized in this function [-Werror=uninitialized]
>>>
>>> Fix by initializing 'val' at start.
>>
>> I don't like sweeping bugs under the carpet like that. The initial
>> value is used when and only when the emulation is buggy. We doubt it
>> can happen. If we truly believe it can't happen, assert it. If we just
>> doubt it, log it.
>
> Markus, that patch would only be an intermediate solution
> which helps to fix a certain class of compiler warnings.
>
> I already promised to test the code with assertions
> and started doing so (see my qemu repository
> http://repo.or.cz/w/qemu/ar7.git/history/HEAD:/hw/eepro100.c).
> Testing takes some time, so the intermediate solution
> can be reasonable.
>
> But nothing will be swept under the carpet!

An intermediate solution could use a comment, but as long as you take
care of the real solution, it's not that important.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]