On 18/03/21 17:34, Christian Borntraeger wrote:
Some compiler versions are smart enough to detect a potentially
uninitialized variable, but are not smart enough to detect that this
cannot happen due to the code flow:

../hw/intc/i8259.c: In function ‘pic_read_irq’:
../hw/intc/i8259.c:203:13: error: ‘irq2’ may be used uninitialized in this 
function [-Werror=maybe-uninitialized]
    203 |         irq = irq2 + 8;
        |         ~~~~^~~~~~~~~~

Restrict irq2 variable use to the inner statement.

Fixes: 78ef2b6989f ("i8259: Reorder intack in pic_read_irq")
Reported-by: Christian Borntraeger <borntrae...@de.ibm.com>
Signed-off-by: Philippe Mathieu-Daudé <phi...@redhat.com>
 Tested-by: Christian Borntraeger <borntrae...@de.ibm.com>


Queued, thanks to both.


Reply via email to