Current trunk g++ warns about an set-but-unused variable in the attached testcase:
~/tmp>g++ -v -W -Wall -c -O2 test.cc Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/afs/mpa/data/martin/ugcc/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /scratch/martin/gcc/configure --disable-bootstrap --enable-gold --enable-plugins --prefix=/afs/mpa/data/martin/ugcc --with-ppl=/afs/mpa/data/martin/numlibs64 --with-cloog=/afs/mpa/data/martin/numlibs64 --with-libelf=/afs/mpa/data/martin/numlibs64 --enable-languages=c++,fortran --enable-target=all --enable-checking=release Thread model: posix gcc version 4.6.0 20100701 (experimental) [trunk revision 161665] (GCC) COLLECT_GCC_OPTIONS='-v' '-W' '-Wall' '-c' '-O2' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /afs/mpa/data/martin/ugcc/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/cc1plus -quiet -v -D_GNU_SOURCE test.cc -quiet -dumpbase test.cc -mtune=generic -march=x86-64 -auxbase test -O2 -W -Wall -version -o /tmp/ccmz9mpH.s GNU C++ (GCC) version 4.6.0 20100701 (experimental) [trunk revision 161665] (x86_64-unknown-linux-gnu) compiled by GNU C version 4.6.0 20100628 (experimental) [trunk revision 161485], GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1 warning: GMP header version 4.3.2 differs from library version 4.3.1. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring nonexistent directory "/afs/mpa/data/martin/ugcc/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../x86_64-unknown-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /afs/mpa/data/martin/ugcc/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../include/c++/4.6.0 /afs/mpa/data/martin/ugcc/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../include/c++/4.6.0/x86_64-unknown-linux-gnu /afs/mpa/data/martin/ugcc/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../include/c++/4.6.0/backward /usr/local/include /afs/mpa/data/martin/ugcc/include /afs/mpa/data/martin/ugcc/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/include /afs/mpa/data/martin/ugcc/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/include-fixed /usr/include End of search list. GNU C++ (GCC) version 4.6.0 20100701 (experimental) [trunk revision 161665] (x86_64-unknown-linux-gnu) compiled by GNU C version 4.6.0 20100628 (experimental) [trunk revision 161485], GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1 warning: GMP header version 4.3.2 differs from library version 4.3.1. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 5f71a12a0438e83fd7b8caa75cf5702d test.cc: In function '__m128d build_V2DF(long long unsigned int, long long unsigned int)': test.cc:10:8: warning: variable 'tmp' set but not used [-Wunused-but-set-variable] COLLECT_GCC_OPTIONS='-v' '-W' '-Wall' '-c' '-O2' '-shared-libgcc' '-mtune=generic' '-march=x86-64' as -V -Qy --64 -o test.o /tmp/ccmz9mpH.s GNU assembler version 2.19.1 (x86_64-unknown-linux-gnu) using BFD version (GNU Binutils) 2.19.1 COMPILER_PATH=/afs/mpa/data/martin/ugcc/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/:/afs/mpa/data/martin/ugcc/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/:/afs/mpa/data/martin/ugcc/libexec/gcc/x86_64-unknown-linux-gnu/:/afs/mpa/data/martin/ugcc/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/:/afs/mpa/data/martin/ugcc/lib/gcc/x86_64-unknown-linux-gnu/ LIBRARY_PATH=/afs/mpa/data/martin/ugcc/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/:/afs/mpa/data/martin/ugcc/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/afs/mpa/data/martin/ugcc/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-v' '-W' '-Wall' '-c' '-O2' '-shared-libgcc' '-mtune=generic' '-march=x86-64' This seems bogus. Other interesting observations: - current trunk gcc (opposed to g++) does not produce the warning - the warning is only given for the case with the SSE2 type, not for the other case with the more "conventional" types. gcc/g++ 4.4.2 and 4.5.* do not issue warnings. -- Summary: [4.6 regression] Bogus set-but-not-used variable warning Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: martin at mpa-garching dot mpg dot de GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44780