qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 04/13] build-sys: add AddressSanitizer when -


From: Marc-André Lureau
Subject: Re: [Qemu-devel] [PATCH v2 04/13] build-sys: add AddressSanitizer when --enable-debug if possible
Date: Wed, 3 Jan 2018 19:02:50 +0100

Hi

On Wed, Jan 3, 2018 at 6:52 PM, Peter Maydell <address@hidden> wrote:
> On 2 January 2018 at 17:31, Paolo Bonzini <address@hidden> wrote:
>> 2) I think removing -O2 from --enable-debug should be removed at the
>> same time.  That pretty much guarantees that nobody will use
>> --enable-debug, and optimized builds are decently debuggable nowadays.
>> The best would be to detect -Og, and add either -Og or -O1 depending on
>> presence.
>
> Hmm. I use --enable-debug all the time and one of the reasons
> I use it is that the optimized build is usually more pain
> to debug with...

       -Og Optimize debugging experience.  -Og enables optimizations
that do not interfere with debugging. It should be the optimization
level of choice for the standard edit-compile-debug cycle, offering
           a reasonable level of optimization while maintaining fast
compilation and a good debugging experience.

That should cover debugging nicely. Tbh, I am quite happy with
compiler default to O0 when --enable-debug. Og doesn't give me much
different experience.

However, it produces false-positive warnings with gcc. Quoting the
patch I was about to send:

    Unfortunately, gcc has many false-positive maybe-uninitialized
    errors with Og and O1 (f27 gcc 7.2.1 20170915):

    /home/elmarco/src/qemu/hw/ipmi/isa_ipmi_kcs.c: In function
‘ipmi_kcs_ioport_read’:
    /home/elmarco/src/qemu/hw/ipmi/isa_ipmi_kcs.c:279:12: error: ‘ret’
may be used uninitialized in this function
[-Werror=maybe-uninitialized]
         return ret;
                ^~~
    cc1: all warnings being treated as errors
    make: *** [/home/elmarco/src/qemu/rules.mak:66:
hw/ipmi/isa_ipmi_kcs.o] Error 1
    make: *** Waiting for unfinished jobs....
    /home/elmarco/src/qemu/hw/ide/ahci.c: In function ‘ahci_populate_sglist’:
    /home/elmarco/src/qemu/hw/ide/ahci.c:903:58: error:
‘tbl_entry_size’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
             if ((off_idx == -1) || (off_pos < 0) || (off_pos >
tbl_entry_size)) {
                                                     ~~~~~~~~~^~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    make: *** [/home/elmarco/src/qemu/rules.mak:66: hw/ide/ahci.o] Error 1
    /home/elmarco/src/qemu/hw/display/qxl.c: In function ‘qxl_add_memslot’:
    /home/elmarco/src/qemu/hw/display/qxl.c:1397:52: error:
‘pci_start’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
         memslot.virt_end   = virt_start + (guest_end   - pci_start);
                                           ~~~~~~~~~~~~~^~~~~~~~~~~~
    /home/elmarco/src/qemu/hw/display/qxl.c:1389:9: error:
‘pci_region’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
             qxl_set_guest_bug(d, "%s: pci_region = %d", __func__, pci_region);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors

    There seems to be a long list of related bugs in upstream GCC, some of
    them are being fixed very recently:
    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24639

    For now, let's workaround it by using Wno-maybe-uninitialized (gcc-only).


-- 
Marc-André Lureau



reply via email to

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