[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug 1874073] Re: openrisc_sim.c:87:42: error: 'cpu_irqs[0]' may be used
From: |
Philippe Mathieu-Daudé |
Subject: |
[Bug 1874073] Re: openrisc_sim.c:87:42: error: 'cpu_irqs[0]' may be used uninitialized in this function [-Werror=maybe-uninitialized] |
Date: |
Tue, 21 Apr 2020 15:08:09 -0000 |
Confirming Peter's suggestion does silent the warning.
-- >8 --
diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c
index d08ce61811..02f5259e5e 100644
--- a/hw/openrisc/openrisc_sim.c
+++ b/hw/openrisc/openrisc_sim.c
@@ -134,6 +134,7 @@ static void openrisc_sim_init(MachineState *machine)
int n;
unsigned int smp_cpus = machine->smp.cpus;
+ assert(smp_cpus >= 1 && smp_cpus <= 2);
for (n = 0; n < smp_cpus; n++) {
cpu = OPENRISC_CPU(cpu_create(machine->cpu_type));
if (cpu == NULL) {
---
--
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1874073
Title:
openrisc_sim.c:87:42: error: 'cpu_irqs[0]' may be used uninitialized
in this function [-Werror=maybe-uninitialized]
Status in QEMU:
New
Bug description:
I see the warning since gcc10:
static void openrisc_sim_init(MachineState *machine):
...
qemu_irq *cpu_irqs[2];
...
serial_mm_init(get_system_memory(), 0x90000000, 0, serial_irq,
115200, serial_hd(0), DEVICE_NATIVE_ENDIAN);
I would initialize cpu_irqs[2] with {}.
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1874073/+subscriptions