qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
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>,
	"Fam Zheng" <famz@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>
Subject: Re: [Qemu-devel] [PATCH] kvm: workaround build break on gcc-7.1.1 / fedora26
Date: Thu, 3 Aug 2017 09:10:29 -0500	[thread overview]
Message-ID: <b999332b-aef1-6f19-0a1c-cf1d4a694b32@redhat.com> (raw)
In-Reply-To: <928f0ce3-159a-e371-6309-078fac31eace@amsat.org>

[-- Attachment #1: Type: text/plain, Size: 2030 bytes --]

On 08/03/2017 08:46 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
>>   in this function [-Werror=maybe-uninitialized]
>>               cap.args[i] = args_tmp[i];                               \
>>                                     ^
>> target/ppc/kvm.c: In function ‘kvmppc_set_papr’:
>> include/sysemu/kvm.h:449:35: error: ‘args_tmp[i]’ may be used
>> uninitialized
>>   in this function [-Werror=maybe-uninitialized]
>> cc1: all warnings being treated as errors
> 
> I'm trying to reproduce this in our docker images (all x86_64 based) but
> can't reproduce.

That's because x86_64 hosts only call kvm_vm_enable_cap() with non-empty
varargs.  But we have:

accel/kvm/kvm-all.c: ret = kvm_vm_enable_cap(s, KVM_CAP_S390_IRQCHIP, 0);

which is only compiled on s390 hosts (or, at least that's my guess,
based on the cap name) - and THAT code is passing empty varargs, which
explains args_tmp[] being a 0-length array, and getting the compiler to
complain about i < 0 always being false.

So my question on IRC was whether we can stack the decks, and force a
non-empty args_tmp = { 0, __VA_ARGS__} coupled by skipping the first
iteration in the for loop.  Or, since cap.args[] is already being
zero-initialized, args_tmp = { __VA_ARGS__, 0 } means the last iteration
of the for loop is a no-op (assigning 0 to something that is already 0)
- although that may be harder to correctly account for both empty and
non-empty __VA_ARGS__.

-- 
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 --]

  reply	other threads:[~2017-08-03 14:11 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
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 [this message]
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=b999332b-aef1-6f19-0a1c-cf1d4a694b32@redhat.com \
    --to=eblake@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=f4bug@amsat.org \
    --cc=famz@redhat.com \
    --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).