https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69726
Bug ID: 69726 Summary: Bogus warnings with -O3 -Wuninitialized Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: jamrial at gmail dot com Target Milestone: --- Created attachment 37636 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37636&action=edit Test case [jamrial@ArchVM ~]$ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/local/lib/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /home/jamrial/gcc-svn/configure --prefix=/usr/local --libdir=/usr/local/lib --libexecdir=/usr/local/lib --mandir=/usr/local/share/man --infodir=/usr/local/share/info --enable-languages=c,c++,lto --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --disable-multilib --disable-bootstrap --disable-werror Thread model: posix gcc version 6.0.0 20160207 (experimental) (GCC) [jamrial@ArchVM ~]$ gcc -Wuninitialized -O3 -c bink_idct.c bink_idct.c: In function ‘bink_idct_put_c’: bink_idct.c:57:9: warning: ‘*((void *)&temp+224)’ is used uninitialized in this function [-Wuninitialized] int temp[64]; ^~~~ bink_idct.c:57:9: warning: ‘*((void *)&temp+192)’ is used uninitialized in this function [-Wuninitialized] bink_idct.c:57:9: warning: ‘*((void *)&temp+160)’ is used uninitialized in this function [-Wuninitialized] bink_idct.c:57:9: warning: ‘*((void *)&temp+128)’ is used uninitialized in this function [-Wuninitialized] bink_idct.c:57:9: warning: ‘*((void *)&temp+96)’ is used uninitialized in this function [-Wuninitialized] bink_idct.c:57:9: warning: ‘*((void *)&temp+64)’ is used uninitialized in this function [-Wuninitialized] bink_idct.c:57:9: warning: ‘*((void *)&temp+32)’ is used uninitialized in this function [-Wuninitialized] bink_idct.c:57:9: warning: ‘temp’ is used uninitialized in this function [-Wuninitialized] This doesn't happen with -fno-tree-vectorize or any optimization level below -O3. gcc 5.3 is unaffected. ffmpeg's test suite makes use of all these functions as you can see here http://coverage.ffmpeg.org/src/libavcodec/binkdsp.c.gcov.html and gcc 5.3 ubsan is happy with it as seen here http://fate.ffmpeg.org/report.cgi?time=20160209015611&slot=x86_64-archlinux-gcc-ubsan so they are most certainly bogus.