From nobody Mon Apr 29 18:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1501685298604445.36606084166306; Wed, 2 Aug 2017 07:48:18 -0700 (PDT) Received: from localhost ([::1]:48123 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcuwb-0008Mi-A8 for importer@patchew.org; Wed, 02 Aug 2017 10:48:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37455) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcuvo-00085Z-PB for qemu-devel@nongnu.org; Wed, 02 Aug 2017 10:47:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcuvl-0002y6-KE for qemu-devel@nongnu.org; Wed, 02 Aug 2017 10:47:28 -0400 Received: from 4.mo178.mail-out.ovh.net ([46.105.49.171]:33473) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dcuvl-0002xZ-DQ for qemu-devel@nongnu.org; Wed, 02 Aug 2017 10:47:25 -0400 Received: from player728.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo178.mail-out.ovh.net (Postfix) with ESMTP id 9E56B44FCD for ; Wed, 2 Aug 2017 16:47:23 +0200 (CEST) Received: from bahia.lan (huguette.tetaneutral.net [91.224.149.27]) (Authenticated sender: groug@kaod.org) by player728.ha.ovh.net (Postfix) with ESMTPA id C233A5400B3; Wed, 2 Aug 2017 16:47:21 +0200 (CEST) From: Greg Kurz To: qemu-devel@nongnu.org Date: Wed, 02 Aug 2017 16:47:14 +0200 Message-ID: <150168523493.31663.3716600121804656211.stgit@bahia.lan> User-Agent: StGit/0.17.1-20-gc0b1b-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Ovh-Tracer-Id: 16571839257746446798 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelkedrjedugdekvdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.49.171 Subject: [Qemu-devel] [PATCH] kvm: workaround build break on gcc-7.1.1 / fedora26 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Building QEMU on fedora26 with the latest gcc package fails: CC ppc64-softmmu/target/ppc/kvm.o In file included from include/sysemu/hw_accel.h:16:0, from target/ppc/kvm.c:31: target/ppc/kvm.c: In function =E2=80=98kvmppc_booke_watchdog_enable=E2=80= =99: include/sysemu/kvm.h:449:35: error: =E2=80=98args_tmp[i]=E2=80=99 may be us= ed uninitialized in this function [-Werror=3Dmaybe-uninitialized] cap.args[i] =3D args_tmp[i]; \ ^ target/ppc/kvm.c: In function =E2=80=98kvmppc_set_papr=E2=80=99: include/sysemu/kvm.h:449:35: error: =E2=80=98args_tmp[i]=E2=80=99 may be us= ed uninitialized in this function [-Werror=3Dmaybe-uninitialized] cc1: all warnings being treated as errors $ rpm -q gcc gcc-7.1.1-3.fc26.ppc64le Testing the size of args_tmp seems to be enough to prevent the warning to pop up. Signed-off-by: Greg Kurz --- include/sysemu/kvm.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 91fc07ee9afe..41fc1005a9ea 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -429,9 +429,11 @@ int kvm_vm_check_extension(KVMState *s, unsigned int e= xtension); }; \ uint64_t args_tmp[] =3D { __VA_ARGS__ }; \ int i; \ - for (i =3D 0; i < (int)ARRAY_SIZE(args_tmp) && \ + if (sizeof(args_tmp)) { \ + for (i =3D 0; i < (int)ARRAY_SIZE(args_tmp) && \ i < ARRAY_SIZE(cap.args); i++) { \ - cap.args[i] =3D args_tmp[i]; \ + cap.args[i] =3D args_tmp[i]; \ + } \ } \ kvm_vm_ioctl(s, KVM_ENABLE_CAP, &cap); \ }) @@ -444,9 +446,11 @@ int kvm_vm_check_extension(KVMState *s, unsigned int e= xtension); }; \ uint64_t args_tmp[] =3D { __VA_ARGS__ }; \ int i; \ - for (i =3D 0; i < (int)ARRAY_SIZE(args_tmp) && \ + if (sizeof(args_tmp)) { \ + for (i =3D 0; i < (int)ARRAY_SIZE(args_tmp) && \ i < ARRAY_SIZE(cap.args); i++) { \ - cap.args[i] =3D args_tmp[i]; \ + cap.args[i] =3D args_tmp[i]; \ + } \ } \ kvm_vcpu_ioctl(cpu, KVM_ENABLE_CAP, &cap); \ })