On Tue, 26 Feb 2019 at 09:06, Thomas Huth <th...@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. But, like using bleeding-edge versions of gcc or clang, if you use an odd set of optimization flags you might find you run into warnings we haven't seen yet and need to make them non-fatal with --disable-werror. (--disable-werror is the default for releases, so you'll only get compile failures if building from git.) Actual "QEMU is broken when built with -O3" issues are definitely worth investigating since they imply either a QEMU bug or a compiler bug. PS: in general -O3 is not necessarily going to generate better code than -O2 if used as a blanket optimization setting -- it can end up generating larger code that increases icache pressure. Probably best used carefully and when benchmarking shows that it's actually an improvement. thanks -- PMM