Bug 43163 - g++ doesn't report uninitialized member variables
g++ doesn't report uninitialized member variables
Status: RESOLVED DUPLICATE of bug 19808
Product: gcc
Classification: Unclassified
Component: c++
4.3.4
: P3 normal
: ---
Assigned To: Not yet assigned to anyone
:
Depends on:
Blocks: Wuninitialized
  Show dependency treegraph
 
Reported: 2010-02-24 12:05 UTC by Bart Van Assche
Modified: 2010-02-24 12:46 UTC (History)
7 users (show)

See Also:
Host: i686-pc-cygwin
Target: i686-pc-cygwin
Build: i686-pc-cygwin
Known to work:
Known to fail:
Last reconfirmed:


Attachments
uninitialized-member-variable.cpp (349 bytes, text/plain)
2010-02-24 12:06 UTC, Bart Van Assche
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bart Van Assche 2010-02-24 12:05:23 UTC
Output produced by the attached test program (as you can see, gcc doesn't warn about initializing member variable m1 with the value of the uninitialized member variable m2):

$ g++ -Wall -o uninitialized-member-variable uninitialized-member-variable.cpp && ./uninitialized-member-variable
a.m1 = 1629547062

$ gcc -v
Using built-in specs.
Target: i686-pc-cygwin
Configured with: /gnu/gcc/releases/packaging/4.3.4-3/gcc4-4.3.4-3/src/gcc-4.3.4/configure --srcdir=/gnu/gcc/releases/packaging/4.3.4-3/gcc4-4.3.4-3/src/gcc-4.3.4 --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --datadir=/usr/share --localstatedir=/var --sysconfdir=/etc --infodir=/usr/share/info --mandir=/usr/share/man --datadir=/usr/share --infodir=/usr/share/info --mandir=/usr/share/man -v --with-gmp=/usr --with-mpfr=/usr --enable-bootstrap --enable-version-specific-runtime-libs --with-slibdir=/usr/bin --libexecdir=/usr/lib --enable-static --enable-shared --enable-shared-libgcc --disable-__cxa_atexit --with-gnu-ld --with-gnu-as --with-dwarf2 --disable-sjlj-exceptions --enable-languages=ada,c,c++,fortran,java,objc,obj-c++ --disable-symvers --enable-libjava --program-suffix=-4 --enable-libgomp --enable-libssp --enable-libada --enable-threads=posix --with-arch=i686 --with-tune=generic --enable-libgcj-sublibs CC=gcc-4 CXX=g++-4 CC_FOR_TARGET=gcc-4 CXX_FOR_TARGET=g++-4 GNATMAKE_FOR_TARGET=gnatmake GNATBIND_FOR_TARGET=gnatbind AS=/opt/gcc-tools/bin/as.exe AS_FOR_TARGET=/opt/gcc-tools/bin/as.exe LD=/opt/gcc-tools/bin/ld.exe LD_FOR_TARGET=/opt/gcc-tools/bin/ld.exe --with-ecj-jar=/usr/share/java/ecj.jar
Thread model: posix
gcc version 4.3.4 20090804 (release) 1 (GCC)
Comment 1 Bart Van Assche 2010-02-24 12:06:10 UTC
Created attachment 19945 [details]
uninitialized-member-variable.cpp
Comment 2 Manuel López-Ibáñez 2010-02-24 12:46:36 UTC
OK. Now I see that this is exactly the same as PR 19808, which was not on my list. Thanks for the report.


*** This bug has been marked as a duplicate of 19808 ***