From: Eric Blake <eblake@redhat.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Greg Kurz" <groug@kaod.org>,
qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] kvm: workaround build break on gcc-7.1.1 / fedora26
Date: Thu, 3 Aug 2017 08:55:34 -0500 [thread overview]
Message-ID: <48882fff-563a-52cc-c215-12f0808857cd@redhat.com> (raw)
In-Reply-To: <dd0512d5-0d7e-3b66-382d-47ee4d1a2de2@amsat.org>
[-- Attachment #1: Type: text/plain, Size: 1498 bytes --]
On 08/03/2017 08:34 AM, Philippe Mathieu-Daudé wrote:
> Hi Greg,
>
> On 08/02/2017 11:47 AM, Greg Kurz wrote:
>> 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 ‘kvmppc_booke_watchdog_enable’:
>> include/sysemu/kvm.h:449:35: error: ‘args_tmp[i]’ may be used
>> uninitialized
>
> This sizeof() use looks unnatural to me. I wonder why not use size_t,
> since this is about sizeof()/ARRAY_SIZE(). The problem seems to come
> from the commit this cast was introduced (61c7bbd236):
>
> target-ppc/kvm.c:1302:21: error: comparison of unsigned expression < 0
> is always false [-Werror=type-limits]
>
> So I'd rather suggest this code, which looks more natural to read to me:
>
> if (ARRAY_SIZE(args_tmp)) {
> for (i = 0; i < ARRAY_SIZE(args_tmp) && ...
For that matter, the existing code is doing:
int i;
i < (int)ARRAY_SIZE(args_tmp)
but wouldn't that be better as:
size_t i;
i < ARRAY_SIZE(args_temp)
I guess we have both the old compilers (per commit 61c7bbd2) and the new
to worry about; although I was unable to reproduce it on Fedora 26 on
x86_64 (is this an architecture-dependent compiler bug?)
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]
next prev parent reply other threads:[~2017-08-03 13:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-02 14:47 [Qemu-devel] [PATCH] kvm: workaround build break on gcc-7.1.1 / fedora26 Greg Kurz
2017-08-03 13:34 ` Philippe Mathieu-Daudé
2017-08-03 13:55 ` Eric Blake [this message]
2017-08-03 14:07 ` Philippe Mathieu-Daudé
2017-08-03 18:38 ` Greg Kurz
2017-08-03 18:56 ` Eric Blake
2017-08-07 11:13 ` Greg Kurz
2017-08-03 14:31 ` Greg Kurz
2017-08-03 13:46 ` Philippe Mathieu-Daudé
2017-08-03 14:10 ` Eric Blake
2017-08-03 14:24 ` Cornelia Huck
2017-08-04 16:54 ` Paolo Bonzini
2017-08-03 14:36 ` Greg Kurz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48882fff-563a-52cc-c215-12f0808857cd@redhat.com \
--to=eblake@redhat.com \
--cc=f4bug@amsat.org \
--cc=groug@kaod.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).