* [Qemu-devel] qemu-upstream compile failure in intel_iommu.c:vtd_context_device_invalidate
@ 2016-01-27 18:23 Olaf Hering
2016-01-28 8:45 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Olaf Hering @ 2016-01-27 18:23 UTC (permalink / raw)
To: Stefano Stabellini; +Cc: xen-devel, qemu-devel
Compiling qemu-xen at 2ce1d30 ("xenfb.c: avoid expensive loops when prod
<= out_cons") leads to this error with -O1:
xen.git/tools/qemu-xen-dir/hw/i386/intel_iommu.c: In function ‘vtd_context_device_invalidate’:
xen.git/tools/qemu-xen-dir/hw/i386/intel_iommu.c:911:46: error: ‘mask’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (vtd_as && ((devfn_it & mask) == (devfn & mask))) {
^
It works with -O2. From the code flow its clear that mask is always
initialized. Looks like gcc 5.2.1 does no proper diagnostic at -O1.
What should be done with such issues, are they fixed in the code?
Olaf
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] qemu-upstream compile failure in intel_iommu.c:vtd_context_device_invalidate
2016-01-27 18:23 [Qemu-devel] qemu-upstream compile failure in intel_iommu.c:vtd_context_device_invalidate Olaf Hering
@ 2016-01-28 8:45 ` Paolo Bonzini
2016-01-28 10:07 ` Peter Maydell
0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2016-01-28 8:45 UTC (permalink / raw)
To: Olaf Hering, Stefano Stabellini; +Cc: xen-devel, qemu-devel
On 27/01/2016 19:23, Olaf Hering wrote:
>
> xen.git/tools/qemu-xen-dir/hw/i386/intel_iommu.c: In function ‘vtd_context_device_invalidate’:
> xen.git/tools/qemu-xen-dir/hw/i386/intel_iommu.c:911:46: error: ‘mask’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> if (vtd_as && ((devfn_it & mask) == (devfn & mask))) {
> ^
> It works with -O2. From the code flow its clear that mask is always
> initialized. Looks like gcc 5.2.1 does no proper diagnostic at -O1.
> What should be done with such issues, are they fixed in the code?
It's probably simplest to add a
default:
abort();
to the switch statement above.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] qemu-upstream compile failure in intel_iommu.c:vtd_context_device_invalidate
2016-01-28 8:45 ` Paolo Bonzini
@ 2016-01-28 10:07 ` Peter Maydell
0 siblings, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2016-01-28 10:07 UTC (permalink / raw)
To: Paolo Bonzini
Cc: Olaf Hering, xen-devel@lists.xensource.com Devel, QEMU Developers,
Stefano Stabellini
On 28 January 2016 at 08:45, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
>
> On 27/01/2016 19:23, Olaf Hering wrote:
>>
>> xen.git/tools/qemu-xen-dir/hw/i386/intel_iommu.c: In function ‘vtd_context_device_invalidate’:
>> xen.git/tools/qemu-xen-dir/hw/i386/intel_iommu.c:911:46: error: ‘mask’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
>> if (vtd_as && ((devfn_it & mask) == (devfn & mask))) {
>> ^
>> It works with -O2. From the code flow its clear that mask is always
>> initialized. Looks like gcc 5.2.1 does no proper diagnostic at -O1.
>> What should be done with such issues, are they fixed in the code?
>
> It's probably simplest to add a
>
> default:
> abort();
>
> to the switch statement above.
glib provides a g_assert_not_reached() for this purpose, which is slightly
more self-documenting.
thanks
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-01-28 10:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-27 18:23 [Qemu-devel] qemu-upstream compile failure in intel_iommu.c:vtd_context_device_invalidate Olaf Hering
2016-01-28 8:45 ` Paolo Bonzini
2016-01-28 10:07 ` Peter Maydell
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).