qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Build error with git commit 8eb29f1bf5a974dc4c11d2d1f5e


From: Thomas Huth
Subject: Re: [Qemu-devel] Build error with git commit 8eb29f1bf5a974dc4c11d2d1f5e7c7f7a62be116 on x86_64
Date: Tue, 26 Feb 2019 13:16:14 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0

On 26/02/2019 12.05, Peter Maydell wrote:
> On Tue, 26 Feb 2019 at 09:06, Thomas Huth <address@hidden> wrote:
>> Ok, then that's the problem here: GCC often produces some additional
>> "may be unused" warnings with -O3, and we normally only guarantee that
>> QEMU compiles without warnings when using the standard -O2 optimization
>> level.
>> So if you want to compile with -O3, you also have to specify
>> --disable-werror (or add -Wno-error=maybe-unitialized to the CFLAGS).
>> But unless you have really an urgent need for O3, I'd rather recommend
>> to compile with the well-tested O2 optimization level instead.
> 
> I think in general we should probably look at fixing warnings
> that occur at -O3 when they're reported to us, even if we don't
> habitually build that way.

Have you ever tried building QEMU with -O3 (and --enable-werror)? That
list ist looong, e.g. here are just the warnings when compiling aarch64:

qemu/block/vmdk.c: In function ‘vmdk_open_vmdk4’:
qemu/block/vmdk.c:741:9: warning: ‘extent’ may be used uninitialized in this 
function [-Wmaybe-uninitialized]
     ret = vmdk_init_tables(bs, extent, errp);
         ^
qemu/block/vmdk.c: In function ‘vmdk_open_sparse’:
qemu/block/vmdk.c:550:9: warning: ‘extent’ may be used uninitialized in this 
function [-Wmaybe-uninitialized]
     ret = vmdk_init_tables(bs, extent, errp);
         ^
qemu/block/vmdk.c:529:17: note: ‘extent’ was declared here
     VmdkExtent *extent;
                 ^
qemu/block/vmdk.c: In function ‘vmdk_open_desc_file.isra.15’:
qemu/block/vmdk.c:893:39: warning: ‘extent’ may be used uninitialized in this 
function [-Wmaybe-uninitialized]
             extent->flat_start_offset = flat_offset << 9;
                                       ^
qemu/block/vmdk.c:823:17: note: ‘extent’ was declared here
     VmdkExtent *extent;
                 ^
qemu/block/nbd-client.c: In function ‘nbd_co_request’:
qemu/block/nbd-client.c:608:8: warning: ‘local_reply.type’ may be used 
uninitialized in this function [-Wmaybe-uninitialized]
     if (chunk->type == NBD_REPLY_TYPE_NONE) {
        ^
qemu/block/nbd-client.c:573:14: note: ‘local_reply.type’ was declared here
     NBDReply local_reply;
              ^
qemu/block/nbd-client.c:614:22: warning: ‘local_reply.flags’ may be used 
uninitialized in this function [-Wmaybe-uninitialized]
     if (chunk->flags & NBD_REPLY_FLAG_DONE) {
                      ^
qemu/block/nbd-client.c:573:14: note: ‘local_reply.flags’ was declared here
     NBDReply local_reply;
              ^
qemu/block/nbd-client.c:601:8: warning: ‘local_reply.<U3390>.magic’ may be used 
uninitialized in this function [-Wmaybe-uninitialized]
     if (nbd_reply_is_simple(reply) || s->quit) {
        ^
qemu/block/nbd-client.c:573:14: note: ‘local_reply.<U3390>.magic’ was declared 
here
     NBDReply local_reply;
              ^
qemu/block/nbd-client.c: In function ‘nbd_client_co_preadv’:
qemu/block/nbd-client.c:209:8: warning: ‘reply.length’ may be used 
uninitialized in this function [-Wmaybe-uninitialized]
     if (chunk->length != sizeof(offset) + sizeof(hole_size)) {
        ^
qemu/block/nbd-client.c:652:14: note: ‘reply.length’ was declared here
     NBDReply reply;
              ^
qemu/block/nbd-client.c:664:9: warning: ‘reply.type’ may be used uninitialized 
in this function [-Wmaybe-uninitialized]
         switch (chunk->type) {
         ^
qemu/block/nbd-client.c:652:14: note: ‘reply.type’ was declared here
     NBDReply reply;
              ^
qemu/block/nbd-client.c:614:22: warning: ‘reply.flags’ may be used 
uninitialized in this function [-Wmaybe-uninitialized]
     if (chunk->flags & NBD_REPLY_FLAG_DONE) {
                      ^
qemu/block/nbd-client.c:652:14: note: ‘reply.flags’ was declared here
     NBDReply reply;
              ^
qemu/block/nbd-client.c: In function ‘nbd_client_co_block_status’:
qemu/block/nbd-client.c:241:8: warning: ‘reply.length’ may be used 
uninitialized in this function [-Wmaybe-uninitialized]
     if (chunk->length != sizeof(context_id) + sizeof(*extent)) {
        ^
qemu/block/nbd-client.c:703:14: note: ‘reply.length’ was declared here
     NBDReply reply;
              ^
qemu/block/nbd-client.c:717:9: warning: ‘reply.type’ may be used uninitialized 
in this function [-Wmaybe-uninitialized]
         switch (chunk->type) {
         ^
qemu/block/nbd-client.c:703:14: note: ‘reply.type’ was declared here
     NBDReply reply;
              ^
qemu/block/nbd-client.c:614:22: warning: ‘reply.flags’ may be used 
uninitialized in this function [-Wmaybe-uninitialized]
     if (chunk->flags & NBD_REPLY_FLAG_DONE) {
                      ^
qemu/block/nbd-client.c:703:14: note: ‘reply.flags’ was declared here
     NBDReply reply;
              ^
qemu/qobject/block-qdict.c: In function ‘qdict_array_split’:
qemu/qobject/block-qdict.c:259:25: warning: ‘subqdict’ may be used 
uninitialized in this function [-Wmaybe-uninitialized]
         qlist_append_obj(*dst, subqobj ?: QOBJECT(subqdict));
                         ^
qemu/hw/intc/i8259.c: In function ‘pic_read_irq’:
qemu/hw/intc/i8259.c:200:13: warning: ‘irq2’ may be used uninitialized in this 
function [-Wmaybe-uninitialized]
         irq = irq2 + 8;
             ^
qemu/migration/qemu-file.c: In function ‘qemu_get_buffer_in_place’:
qemu/migration/qemu-file.c:537:18: warning: ‘src’ may be used uninitialized in 
this function [-Wmaybe-uninitialized]
             *buf = src;
                  ^
qemu/slirp/socket.c: In function ‘soread’:
qemu/slirp/socket.c:232:5: warning: ‘n’ may be used uninitialized in this 
function [-Wmaybe-uninitialized]
  if (n == 2 && nn == iov[0].iov_len) {
     ^
In file included from /usr/lib64/glib-2.0/include/glibconfig.h:9:0,
                 from /usr/include/glib-2.0/glib/gtypes.h:32,
                 from /usr/include/glib-2.0/glib/galloca.h:32,
                 from /usr/include/glib-2.0/glib.h:30,
                 from qemu/slirp/ip.h:36,
                 from qemu/slirp/slirp.h:50,
                 from qemu/slirp/socket.c:8:
qemu/slirp/socket.c: In function ‘soreadbuf’:
/usr/include/glib-2.0/glib/gmacros.h:300:39: warning: ‘iov.iov_len’ may be used 
uninitialized in this function [-Wmaybe-uninitialized]
 #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
                                       ^
qemu/slirp/socket.c:253:15: note: ‘iov.iov_len’ was declared here
  struct iovec iov[2];
               ^
qemu/slirp/socket.c: In function ‘sorecvoob’:
qemu/slirp/socket.c:232:5: warning: ‘n’ may be used uninitialized in this 
function [-Wmaybe-uninitialized]
  if (n == 2 && nn == iov[0].iov_len) {
     ^
qemu/slirp/socket.c:175:6: note: ‘n’ was declared here
  int n, nn;
      ^
qemu/gdbstub.c: In function ‘gdb_handle_packet’:
qemu/gdbstub.c:1655:17: warning: ‘tid’ may be used uninitialized in this 
function [-Wmaybe-uninitialized]
             cpu = gdb_get_cpu(s, pid, tid);
                 ^
qemu/gdbstub.c:1655:17: warning: ‘pid’ may be used uninitialized in this 
function [-Wmaybe-uninitialized]
qemu/target/arm/translate-a64.c: In function ‘disas_simd_two_reg_misc_fp16’:
qemu/target/arm/translate-a64.c:12529:34: warning: ‘rmode’ may be used 
uninitialized in this function [-Wmaybe-uninitialized]
         tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rmode));
                                  ^

IIRC, most of the time, GCC is just wrong, so I really
doubt that it is worth the effort to fix all of them ...

 Thomas



reply via email to

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