From nobody Wed Feb 11 02:12:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1591795434; cv=none; d=zohomail.com; s=zohoarc; b=KHllfR/CzZzSqjXoHP1WGDKqgp1tDjaBi6MD7jS/1ePUh6B7BcMJjdVFh2plz6igJ/gkqDjOv8K6Vx2rURl7QrRPokZRc/bBkoHYFUo2EUfjP7HxZmsJJgoyKZx+ORGQB6R6Hn78whvRdLV8OvRMp2rwbV/kngunOQMptX8UC8I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591795434; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fTbKsNrJdd1VRs/45tgMkoTZ1o5n+wZ2qzSxL+C7I2Q=; b=J5nzIfgDmGUT0ZNWakshwjFeLARlBgfCVNnU+MxmhK6GgYWJd7jKxl/ys9LTrs0oKaXeQ2eDLnxziOpSNe1qVGRfgnc3FoGpilt/bzoTT4JK7XM7VoM0+LS5v5XawSW/9eGR4eB+xhRs/E4yebGOifr6TU/+7v8NwUknJLFofBU= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591795434295309.0180198634216; Wed, 10 Jun 2020 06:23:54 -0700 (PDT) Received: from localhost ([::1]:46092 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jj0hs-0001Wz-PA for importer@patchew.org; Wed, 10 Jun 2020 09:23:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45254) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jj0Uy-00081B-QI; Wed, 10 Jun 2020 09:10:32 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:56849) by eggs.gnu.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jj0Ux-0003iZ-GY; Wed, 10 Jun 2020 09:10:32 -0400 Received: from localhost.localdomain ([82.252.135.106]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1N5mOZ-1iqdNM3MqZ-017G53; Wed, 10 Jun 2020 15:10:24 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL v2 15/16] hw/openrisc/openrisc_sim: Add assertion to silence GCC warning Date: Wed, 10 Jun 2020 15:10:10 +0200 Message-Id: <20200610131011.1941209-16-laurent@vivier.eu> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200610131011.1941209-1-laurent@vivier.eu> References: <20200610131011.1941209-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:8hggNOYDOPfXdValh0/LtwKsrJvnZ4EGWVtbAUwp4s8OL/Fywjr XM8ycjFTSCPGAN2lT70Si/9ZKlNzKz4q/t6UAuSq8IoixVgFpI9l3zb6Yv9nxbTdu7T4cw9 /QZ1kAQqEZfpoOKWn01BZtV70gNxTqFmEySF5H27YRkrwHpsP+mRxvZNVJrXZMiZtsk4SxM INW3G9NIAo32IrI1A2ngw== X-UI-Out-Filterresults: notjunk:1;V03:K0:ZQZSn2q+FiE=:utUpGYNOY2gkjdSNwg1Qdr SuHTxbDfUhNJeHTex7w5KiKoeXtrpaPqRVRZxxYoqK+CR8u0z6oBT5s8HuuwpL7Q8LUb6sVun yb3JTSV3ixfDOLK2slgywpc4e9A1tPCd5uZk4Ht/WE7FqZLlyqtfZWDVOeY8vpogUciuTk7v8 Wyl67YSXn2k3WxM2A8ejAHGyhsSR5kXnHWLADJ5IsifLok4RX8LHC8onEvFUqxaUxh777UmIj HcAshB5/pfmTKejbNJmuQPSwPEyaXW0VnfZnO7MvHubSvZAIbsaLTjzL77xx5Qpr/DDgu5e62 29O6pLA2RNzpm7ryrA/M1WeVFoVxXMZYffHXSznimV8LjI4kfg2d3M2X1P+3ehMtbWP6SiaW1 A38ePOtiKNCNPT5RMsczmXftCkYndT0oGoFlNLyLOsSDomjDvjXBLrswwwbfLSIwhkttN/I4W YSHFocH4FCyYnnJbSH1Ie9EYhW3qJ3emBbY/pibenvOadoiq5qLjxFbdV50ML/1VXuj4vjwG6 SSxBmNaH6I6QgXdx12+IsNlmqgk3xXK1Yl8ev9OJL2W/3W2LS6jYZPJ40njrQIPT9+fZwLKJm SRX/xLKfpdH+RiW0juQmdyLCg4AMDa8TG3JwopX/76KKZ+NYNY24DU47SbD8OoopC+zrx/lrC R+rhM4+Xso7/tS7w70Y24poBpfks/gCILThahOZdEk/50OCQJpqqA6sHUPTFy0hu2qgsoI5la fT1Ou/xEV521eoAxXP/3FvgXPd5JzCt7fa6FtcWpFei2fMR4iLOTb7PRVunH6IaFEqS5nn3SL EkCvG2eciz2EfVaNkyfzeM4eDpHMcFu0Qu4npbjWfiOb+BCJ84XOmQfy3D1jhzdSsjC1CgV Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=212.227.126.135; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/10 08:14:00 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-trivial@nongnu.org, =?UTF-8?q?Martin=20Li=C5=A1ka?= , Michael Tokarev , Laurent Vivier , Stafford Horne , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daud=C3=A9 When compiling with GCC 10 (Fedora 32) using CFLAGS=3D-O2 we get: CC or1k-softmmu/hw/openrisc/openrisc_sim.o hw/openrisc/openrisc_sim.c: In function =E2=80=98openrisc_sim_init=E2=80= =99: hw/openrisc/openrisc_sim.c:87:42: error: =E2=80=98cpu_irqs[0]=E2=80=99 ma= y be used uninitialized in this function [-Werror=3Dmaybe-uninitialized] 87 | sysbus_connect_irq(s, i, cpu_irqs[i][irq_pin]); | ~~~~~~~~^~~ While humans can tell smp_cpus will always be in the [1, 2] range, (openrisc_sim_machine_init sets mc->max_cpus =3D 2), the compiler can't. Add an assertion to give the compiler a hint there's no use of uninitialized data. Buglink: https://bugs.launchpad.net/qemu/+bug/1874073 Reported-by: Martin Li=C5=A1ka Suggested-by: Peter Maydell Reviewed-by: Thomas Huth Tested-by: Eric Blake Reviewed-by: Eric Blake Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Acked-by: Stafford Horne Message-Id: <20200608160611.16966-1-philmd@redhat.com> Signed-off-by: Laurent Vivier --- 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 d08ce6181199..02f5259e5e33 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 =3D machine->smp.cpus; =20 + assert(smp_cpus >=3D 1 && smp_cpus <=3D 2); for (n =3D 0; n < smp_cpus; n++) { cpu =3D OPENRISC_CPU(cpu_create(machine->cpu_type)); if (cpu =3D=3D NULL) { --=20 2.26.2