Hello, the attached code compiles without any warning when compiled with the command g++ -W -Wall any.cpp -c -o any.o but x gets initialised from itself, actually dereferencing x prior to initializing it. At this point it is trivial that x wasn't initialised. Using built-in specs. Target: x86_64-pc-linux-gnu Configured with: /var/tmp/portage/sys-devel/gcc-4.1.2/work/gcc-4.1.2/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.1.2 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.1.2 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.1.2/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.1.2/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --enable-multilib --enable-libmudflap --disable-libssp --enable-java-awt=gtk --enable-languages=c,c++,java,treelang,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu Thread model: posix gcc version 4.1.2 (Gentoo 4.1.2 p1.1)
Created attachment 15925 [details] any.cpp
To fix this testcase we would need to fix a few of the -Wuninitialized issues, since -Wuninitialized does not work without optimisation, we don't handle VOPs (no -Wunitialized for pointers then), and -Winit-self is broken for some cases. Nonetheless, fixing PR19808 would be a start. *** This bug has been marked as a duplicate of 19808 ***