qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] kvm: workaround build break on gcc-7.1.1 / fedo


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] kvm: workaround build break on gcc-7.1.1 / fedora26
Date: Thu, 3 Aug 2017 09:10:29 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

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: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]