https://bugs.kde.org/show_bug.cgi?id=439685

Mark Wielaard <m...@klomp.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |m...@klomp.org

--- Comment #1 from Mark Wielaard <m...@klomp.org> ---
Thanks for the analysis and the patch. Pushed as:

commit d270b7b15bafd7eb555994483556e3c22400bf47
Author: Mark Wielaard <m...@klomp.org>
Date:   Thu Apr 20 00:42:40 2023 +0200

    Bug 439685 compiler warning in callgrind/main.c

    main.c: In function 'vgCallgrind_post_syscalltime':
    main.c:1779:25: warning: '*((void *)&ts_now+8)'
        may be used uninitialized in this function [-Wmaybe-uninitialized]
         struct vki_timespec ts_now;
    main.c:1779:25: warning: 'ts_now'
        may be used uninitialized in this function [-Wmaybe-uninitialized]

    In function collect_time the conditional expression in the switch
    statement has type int (after integral promotions). GCC assumes that
    it may have values other than the ones listed in the enumerated type
    it was promoted from.  In that case the memory pointed to by its 1st
    argument remains unintialised.  Later on vki_timespec_diff will read
    the contents of ts_now undoditionally.  Hence the warning.

    Using the default case for the tl_assert () removes the warning and
    makes the code more robust should another enumerator ever be added to
    Collect_Systime.

    Contributed-by: Florian Krohm <flor...@eich-krohm.de>

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to