qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Andrew Randrianasulu <randrianasulu@gmail.com>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Build error with git commit 8eb29f1bf5a974dc4c11d2d1f5e7c7f7a62be116 on x86_64
Date: Tue, 26 Feb 2019 13:16:14 +0100	[thread overview]
Message-ID: <a973e888-0a52-da7f-2885-dbb427b58f7e@redhat.com> (raw)
In-Reply-To: <CAFEAcA8idrLohrWrieChU1Mm55NVaiEAXYQZEcNP5Dy2QjqeKg@mail.gmail.com>

On 26/02/2019 12.05, Peter Maydell wrote:
> On Tue, 26 Feb 2019 at 09:06, Thomas Huth <thuth@redhat.com> 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	other threads:[~2019-02-26 12:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-23  0:35 [Qemu-devel] Build error with git commit 8eb29f1bf5a974dc4c11d2d1f5e7c7f7a62be116 on x86_64 Andrew Randrianasulu
2019-02-25 14:13 ` Eric Blake
2019-02-25 16:19 ` Philippe Mathieu-Daudé
2019-02-25 17:29   ` Andrew Randrianasulu
2019-02-26  8:54     ` Thomas Huth
2019-02-26  8:58       ` Andrew Randrianasulu
2019-02-26  9:05         ` Thomas Huth
2019-02-26  9:46           ` Andrew Randrianasulu
2019-02-26  9:58             ` Thomas Huth
2019-02-26 10:44               ` Andrew Randrianasulu
2019-02-26 11:05           ` Peter Maydell
2019-02-26 12:16             ` Thomas Huth [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a973e888-0a52-da7f-2885-dbb427b58f7e@redhat.com \
    --to=thuth@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=randrianasulu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).