https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105593

--- Comment #3 from Rogério de Souza Moraes <rogerio.souza at gmail dot com> ---
The code attached in the previous comment triggers the "warning: '__Y' is used
uninitialized [-Wuninitialized]".

The command line to compile it is:

/grid/common/test/gcc-v12.1.0d1rh74_lnx86/bin/gcc -c -O3 -Wall ./a.C

Using "-O1/-O2/-O3" the warning below is raised:

In file included from
/grid/common/test/gcc-v12.1.0d1rh74_lnx86/lib/gcc/x86_64-redhat-linux/12.1.0/include/immintrin.h:49,
                 from ./a.C:1:
In function '__m512i _mm512_permutexvar_epi64(__m512i, __m512i)',
    inlined from 'void UINT512_t::ithBit(int)' at ./a.C:12:40,
    inlined from 'WORD_t ithBitWORD(int) [with WORD_t = UINT512_t]' at
./a.C:27:13:
/grid/common/test/gcc-v12.1.0d1rh74_lnx86/lib/gcc/x86_64-redhat-linux/12.1.0/include/avx512fintrin.h:6994:10:
warning: '__Y' is used uninitialized [-Wuninitialized]
 6994 |   return (__m512i) __builtin_ia32_permvardi512_mask ((__v8di) __Y,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 6995 |                                                      (__v8di) __X,
      |                                                      ~~~~~~~~~~~~~
 6996 |                                                      (__v8di)
      |                                                      ~~~~~~~~
 6997 |                                                     
_mm512_undefined_epi32 (),
      |                                                     
~~~~~~~~~~~~~~~~~~~~~~~~~~
 6998 |                                                      (__mmask8) -1);
      |                                                      ~~~~~~~~~~~~~~
/grid/common/test/gcc-v12.1.0d1rh74_lnx86/lib/gcc/x86_64-redhat-linux/12.1.0/include/avx512fintrin.h:
In function 'WORD_t ithBitWORD(int) [with WORD_t = UINT512_t]':
/grid/common/test/gcc-v12.1.0d1rh74_lnx86/lib/gcc/x86_64-redhat-linux/12.1.0/include/avx512fintrin.h:206:11:
note: '__Y' was declared here
  206 |   __m512i __Y = __Y;
      |           ^~~


When compiling with -O0, the warning does not happen, so I believe it is due to
the optimization that probably reduces the assembly code and triggers the
warning. Is it correct? If so, what would be the best approach to suppress it?
Would it be '#pragma GCC diagnostic ignored "-Wuninitialized"'?

Reply via email to