git: contrib/gcc-12: Silence -Wmaybe-uninitialized warning

Aaron LI aly at crater.dragonflybsd.org
Sat Oct 17 06:08:29 PDT 2026


commit e42f05a48b9d31a0e74d964217666bc54e646e55
Author: Aaron LI <aly at aaronly.me>
Date:   Fri Oct 16 20:09:28 2026 +0800

    contrib/gcc-12: Silence -Wmaybe-uninitialized warning
    
    GCC 12.5 would generate the following -Wmaybe-uninitialized warning for
    expmed.cc, which defines the #pragma to force this diagnostic to be a
    warning, so the GCC's own bootstrap that uses -Werror could succeed.
    However, this #pragma makes this warning can't be silenced by a
    -Wno-maybe-uninitialized option on the command line. So just modify the
    source file to ignore it.
    
    ```
    /usr/src/gnu/usr.bin/cc120/libbackend/../../../../contrib/gcc-12/gcc/expmed.cc: In function 'rtx_def* extract_bit_field_1(rtx, poly_uint64, poly_uint64, int, rtx, machine_mode, machine_mode, bool, bool, rtx_def**)':
    /usr/src/gnu/usr.bin/cc120/libbackend/../../../../contrib/gcc-12/gcc/expmed.cc:1832:45: warning: '*(unsigned int*)((char*)&imode + offsetof(scalar_int_mode, scalar_int_mode::m_mode))' may be used uninitialized [-Wmaybe-uninitialized]
     1832 |       rtx sub = extract_bit_field_as_subreg (mode1, op0, imode,
          |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
     1833 |                                              bitsize, bitnum);
          |                                              ~~~~~~~~~~~~~~~~
    /usr/src/gnu/usr.bin/cc120/libbackend/../../../../contrib/gcc-12/gcc/expmed.cc:1792:19: note: '*(unsigned int*)((char*)&imode + offsetof(scalar_int_mode, scalar_int_mode::m_mode))' was declared here
     1792 |   scalar_int_mode imode;
          |                   ^~~~~
    ```
    
    [1] GCC Bug 91825: [10 regression] Bogus -Wmaybe-uninitialized with r275744 breaks bootstrap
        https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91825
    [2] GCC commit: Fix conversions for built-in operator overloading candidates
        https://gcc.gnu.org/cgit/gcc/commit/?id=b63566a4045e9cc27f739c89f863dbfb9dbe7860

Summary of changes:
 contrib/gcc-12/gcc/expmed.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/e42f05a48b9d31a0e74d964217666bc54e646e55


-- 
DragonFly BSD source repository


More information about the Commits mailing list