On 03/08/2017 16:24, Cornelia Huck wrote: > On Thu, 3 Aug 2017 09:10:29 -0500 > Eric Blake <ebl...@redhat.com> wrote: > >> 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. > > There's > > target/i386/kvm.c: kvm_vcpu_enable_cap(cs, KVM_CAP_HYPERV_SYNIC, > 0)) { > >> 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) > > I don't see how the compiler can optimize this away, as the check for > this cap is an ioctl...
Indeed. This is a compiler bug and it only provides a warning (meaning --disable-werror silences it). I don't think it's a good idea to uglify the code for something that the compiler should easily optimize away... Paolo > This seems a bit ugly. And I still don't understand why this only seems > to hit on ppc...