Some variations of bug #53989 still seem to exist (or gcc 4.7.2 does not contain a complete fix for that bug). $ cat Test.cpp template<typename T> struct vec3t { T c[3]; }; typedef vec3t<float> vec3; class Bounds { public: Bounds(const vec3 bb[2]); void foo(const vec3 & v) { v.c[0]; } }; template<typename T> void work(T& value); void foo() { vec3 bb[2]; work(bb); } $ g++ -Wall -c Test.cpp Test.cpp: In member function 'void Bounds::foo(const vec3&)': Test.cpp:11:38: warning: statement has no effect [-Wunused-value] Test.cpp: In function 'void foo()': Test.cpp:19:10: internal compiler error: in strip_typedefs, at cp/tree.c:1199 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. $ g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/opt/gcc-4.7.2/libexec/gcc/x86_64-unknown-linux-gnu/4.7.2/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../configure --prefix=/opt/gcc-4.7.2 --enable-languages=c,c++,fortran --disable-multilib Thread model: posix gcc version 4.7.2 (GCC)
Let's add Jason in CC about this. Besides PR53989, it seems also related to the following PR54038.
Author: jason Date: Thu Dec 6 20:20:34 2012 New Revision: 194265 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194265 Log: PR c++/55032 * tree.c (build_array_type_1): Re-layout if we found it in the hash table. Added: trunk/gcc/testsuite/g++.dg/template/array24.C Modified: trunk/gcc/ChangeLog trunk/gcc/tree.c
Author: jason Date: Thu Dec 6 20:21:29 2012 New Revision: 194268 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194268 Log: PR c++/55032 * tree.c (build_array_type_1): Re-layout if we found it in the hash table. Added: branches/gcc-4_7-branch/gcc/testsuite/g++.dg/template/array24.C Modified: branches/gcc-4_7-branch/gcc/ChangeLog branches/gcc-4_7-branch/gcc/tree.c
Fixed.
Author: jason Date: Fri Dec 7 04:58:45 2012 New Revision: 194286 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194286 Log: PR c++/55032 * tree.c (build_array_type_1): Re-layout if we found it in the hash table. Added: branches/gcc-4_6-branch/gcc/testsuite/g++.dg/template/array24.C Modified: branches/gcc-4_6-branch/gcc/ChangeLog branches/gcc-4_6-branch/gcc/tree.c
FYI, when we picked up r194286 into google/gcc-4_7 branch, and ran our 500,000 validation tests, we discovered two instances of mis-compilation. This code: typedef vector<void*> T[13]; void foo() { T x; ... } is mis-compiled to omit 13 calls to vector::vector, and x[0], x[1], etc. all contain uninitialized stack garbage data members. I've confirmed that trunk compiler is similarly broken. Unfortunately I haven't been able to reduce the test case that exposes the problem yet.
(In reply to comment #6) > Unfortunately I haven't been able to reduce the test case that exposes the > problem yet. It took a whole week, but I finally have reduced test case in PR55804.
Author: jason Date: Wed Jan 2 19:03:04 2013 New Revision: 194811 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194811 Log: PR c++/55804 PR c++/55032 PR c++/55245 * tree.c (build_array_type_1): Revert earlier change. * cp/tree.c (build_cplus_array_type): Copy layout information to main variant if necessary. Added: trunk/gcc/testsuite/g++.dg/init/array33.C Modified: trunk/gcc/ChangeLog trunk/gcc/cp/ChangeLog trunk/gcc/cp/tree.c trunk/gcc/tree.c
Author: jason Date: Wed Jan 2 19:03:37 2013 New Revision: 194812 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194812 Log: PR c++/55804 PR c++/55032 PR c++/55245 * tree.c (build_array_type_1): Revert earlier change. * cp/tree.c (build_cplus_array_type): Copy layout information to main variant if necessary. Added: branches/gcc-4_7-branch/gcc/testsuite/g++.dg/init/array33.C Modified: branches/gcc-4_7-branch/gcc/ChangeLog branches/gcc-4_7-branch/gcc/cp/ChangeLog branches/gcc-4_7-branch/gcc/cp/tree.c branches/gcc-4_7-branch/gcc/tree.c
Author: jason Date: Wed Jan 2 19:03:46 2013 New Revision: 194813 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194813 Log: PR c++/55804 PR c++/55032 PR c++/55245 * tree.c (build_array_type_1): Revert earlier change. * cp/tree.c (build_cplus_array_type): Copy layout information to main variant if necessary. Added: branches/gcc-4_6-branch/gcc/testsuite/g++.dg/init/array33.C Modified: branches/gcc-4_6-branch/gcc/ChangeLog branches/gcc-4_6-branch/gcc/cp/ChangeLog branches/gcc-4_6-branch/gcc/cp/tree.c branches/gcc-4_6-branch/gcc/tree.c