diff mbox

Build failure on git master

Message ID 7ca287e3-c496-b58f-7df6-e0e82ea56ff0@ilande.co.uk
State New
Headers show

Commit Message

Mark Cave-Ayland July 20, 2017, 7:29 p.m. UTC
On 19/07/17 18:09, Mark Cave-Ayland wrote:

> Hi all,
> 
> I see the following build failure here on git master with gcc 4.7.2:
> 
> cc -I/home/build/src/qemu/git/qemu/block -Iblock
> -I/home/build/src/qemu/git/qemu/tcg
> -I/home/build/src/qemu/git/qemu/tcg/i386
> -I/home/build/src/qemu/git/qemu/linux-headers
> -I/home/build/src/qemu/git/qemu/linux-headers -I.
> -I/home/build/src/qemu/git/qemu
> -I/home/build/src/qemu/git/qemu/accel/tcg
> -I/home/build/src/qemu/git/qemu/include -I/usr/include/pixman-1
> -I/home/build/src/qemu/git/qemu/dtc/libfdt -Werror -pthread
> -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
> -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
> -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings
> -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv
> -Wendif-labels -Wno-missing-include-dirs -Wempty-body -Wnested-externs
> -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers
> -Wold-style-declaration -Wold-style-definition -Wtype-limits
> -fstack-protector-all -I/usr/include/p11-kit-1
> -I/usr/include/libpng12   -I/home/build/src/qemu/git/qemu/tests -MMD -MP
> -MT block/vpc.o -MF block/vpc.d -O2 -U_FORTIFY_SOURCE
> -D_FORTIFY_SOURCE=2 -g   -c -o block/vpc.o block/vpc.c
> block/vpc.c: In function ‘vpc_co_pwritev’:
> block/vpc.c:652:9: error: ‘ret’ may be used uninitialized in this
> function [-Werror=maybe-uninitialized]
> cc1: all warnings being treated as errors
> make: *** [block/vpc.o] Error 1
> 
> At a quick glance it looks as if this is being caused by commit cfc87e00
> "block/vpc.c: Handle write failures in get_image_offset()".

The fix is seemingly quite simple:



ATB,

Mark.

Comments

Peter Maydell July 20, 2017, 9:09 p.m. UTC | #1
On 20 July 2017 at 20:29, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
> On 19/07/17 18:09, Mark Cave-Ayland wrote:
>
>> Hi all,
>>
>> I see the following build failure here on git master with gcc 4.7.2:
>>
>> cc -I/home/build/src/qemu/git/qemu/block -Iblock
>> -I/home/build/src/qemu/git/qemu/tcg
>> -I/home/build/src/qemu/git/qemu/tcg/i386
>> -I/home/build/src/qemu/git/qemu/linux-headers
>> -I/home/build/src/qemu/git/qemu/linux-headers -I.
>> -I/home/build/src/qemu/git/qemu
>> -I/home/build/src/qemu/git/qemu/accel/tcg
>> -I/home/build/src/qemu/git/qemu/include -I/usr/include/pixman-1
>> -I/home/build/src/qemu/git/qemu/dtc/libfdt -Werror -pthread
>> -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
>> -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
>> -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings
>> -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv
>> -Wendif-labels -Wno-missing-include-dirs -Wempty-body -Wnested-externs
>> -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers
>> -Wold-style-declaration -Wold-style-definition -Wtype-limits
>> -fstack-protector-all -I/usr/include/p11-kit-1
>> -I/usr/include/libpng12   -I/home/build/src/qemu/git/qemu/tests -MMD -MP
>> -MT block/vpc.o -MF block/vpc.d -O2 -U_FORTIFY_SOURCE
>> -D_FORTIFY_SOURCE=2 -g   -c -o block/vpc.o block/vpc.c
>> block/vpc.c: In function ‘vpc_co_pwritev’:
>> block/vpc.c:652:9: error: ‘ret’ may be used uninitialized in this
>> function [-Werror=maybe-uninitialized]
>> cc1: all warnings being treated as errors
>> make: *** [block/vpc.o] Error 1
>>
>> At a quick glance it looks as if this is being caused by commit cfc87e00
>> "block/vpc.c: Handle write failures in get_image_offset()".
>
> The fix is seemingly quite simple:
>
> diff --git a/block/vpc.c b/block/vpc.c
> index 10e6519..574879b 100644
> --- a/block/vpc.c
> +++ b/block/vpc.c
> @@ -649,7 +649,7 @@ vpc_co_pwritev(BlockDriverState *bs, uint64_t
> offset, uint64_t bytes,
>      int64_t image_offset;
>      int64_t n_bytes;
>      int64_t bytes_done = 0;
> -    int ret;
> +    int ret = 0;
>      VHDFooter *footer =  (VHDFooter *) s->footer_buf;

Yeah, I think 4.7.2 isn't smart enough to realize this is
a false positive (and that compiler is getting old enough
that it's not in the set I usually test with).

Do you want to send a proper patch?

thanks
-- PMM
Mark Cave-Ayland July 21, 2017, 8:26 a.m. UTC | #2
On 20/07/17 22:09, Peter Maydell wrote:

>> The fix is seemingly quite simple:
>>
>> diff --git a/block/vpc.c b/block/vpc.c
>> index 10e6519..574879b 100644
>> --- a/block/vpc.c
>> +++ b/block/vpc.c
>> @@ -649,7 +649,7 @@ vpc_co_pwritev(BlockDriverState *bs, uint64_t
>> offset, uint64_t bytes,
>>      int64_t image_offset;
>>      int64_t n_bytes;
>>      int64_t bytes_done = 0;
>> -    int ret;
>> +    int ret = 0;
>>      VHDFooter *footer =  (VHDFooter *) s->footer_buf;
> 
> Yeah, I think 4.7.2 isn't smart enough to realize this is
> a false positive (and that compiler is getting old enough
> that it's not in the set I usually test with).
> 
> Do you want to send a proper patch?

Done. Hopefully one of these days I'll be able to figure out how to
migrate everything on the laptop across to something a bit more modern...


ATB,

Mark.
diff mbox

Patch

diff --git a/block/vpc.c b/block/vpc.c
index 10e6519..574879b 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -649,7 +649,7 @@  vpc_co_pwritev(BlockDriverState *bs, uint64_t
offset, uint64_t bytes,
     int64_t image_offset;
     int64_t n_bytes;
     int64_t bytes_done = 0;
-    int ret;
+    int ret = 0;
     VHDFooter *footer =  (VHDFooter *) s->footer_buf;
     QEMUIOVector local_qiov;