qemu/gcc10-maybe-uninitialized.patch

31 lines
1.0 KiB
Diff

From: Bruce Rogers <brogers@suse.com>
Date: Wed, 22 Apr 2020 08:50:55 -0600
Subject: gcc10: maybe-uninitialized
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
References: boo#1169728
gcc 10 needs some help to understand that indeed cpu_irqs[0] does get
initialized in all cases. In this case an assert is sufficient.
Reported-by: Martin Liška <mliska@suse.cz>
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
hw/openrisc/openrisc_sim.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c
index d08ce6181199aa1e75a7c5bc2157..02f5259e5e33272b17bba701f5d5 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) {