Upgrading from 4.4.2 to 4.4.3, gcc now segfaults when compiling my file. I've narrowed both the command line and the cpp file (30 lines, visible at the end of the *.ii attached). Most of the included code is from eigen (http://eigen.tuxfamily.org/) and is publicly visible on http://bitbucket.org/eigen/eigen When compiled with -O2 or -O3 the segfaults is triggered, without -O option, the file compiles fine. The complete line i use is: g++ -c -O3 -I../../eigen2-tip -o ice.o ice.cpp -save-temps The output is: ---------------------------------------------------------------------------- In file included from ../../eigen2-tip/Eigen/Core:178, from ../../eigen2-tip/unsupported/Eigen/NonLinearOptimization:29, from ice.cpp:3: ../../eigen2-tip/Eigen/src/Core/DenseStorageBase.h: In member function ‘Eigen::LevenbergMarquardtSpace::Status Eigen::LevenbergMarquardt<FunctorType, Scalar>::minimizeOneStep(Eigen::Matrix<Scalar, 33331, 1, 0, 33331, 1>&, int) [with FunctorType = myFunctor, Scalar = double]’: ../../eigen2-tip/Eigen/src/Core/DenseStorageBase.h:516: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <http://bugs.gentoo.org/> for instructions. ---------------------------------------------------------------------------- The output of gcc -v is (i'm using gentoo) : ---------------------------------------------------------------------------- Using built-in specs. Target: x86_64-pc-linux-gnu Configured with: /usr/data/tmp/portage/sys-devel/gcc-4.4.3/work/gcc-4.4.3/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.4.3 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.3/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.3 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.3/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.3/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.3/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --without-ppl --without-cloog --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --enable-multilib --enable-libmudflap --disable-libssp --enable-libgomp --enable-cld --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.4.3/python --disable-libgcj --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.4.3 p1.0' Thread model: posix gcc version 4.4.3 (Gentoo 4.4.3 p1.0) ----------------------------------------------------------------------------
Created attachment 19836 [details] as provided by -save-temps
It is caused by revision 153881: http://gcc.gnu.org/ml/gcc-cvs/2009-11/msg00097.html
Confirmed. Works on the trunk.
This is basically the same bug as PR 41183. We crash when trying to do name lookup during template substitution during mangling during compilation of a clone. Cloning doesn't copy cfun->language, so current_binding_level tries to look inside it and SEGVs.
Created attachment 19854 [details] delta-reduced testcase this testcase is a lot smaller, but still not as reduced as I'd like
Subject: Bug 43024 Author: jason Date: Fri Feb 12 22:27:04 2010 New Revision: 156740 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156740 Log: PR c++/43024 * name-lookup.h (current_binding_level): Check for null cp_function_chain. Modified: branches/gcc-4_4-branch/gcc/cp/ChangeLog branches/gcc-4_4-branch/gcc/cp/name-lookup.h
Subject: Bug 43024 Author: jason Date: Fri Feb 12 22:27:14 2010 New Revision: 156741 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156741 Log: PR c++/43024 * name-lookup.h (current_binding_level): Check for null cp_function_chain. Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/name-lookup.h
Created attachment 19855 [details] ice16.ii Slightly reduced testcase using some more delta, I'm afraid now needs some manual work to help further reduction and don't have time for that right now.
Created attachment 19865 [details] Further reduced testcase
The reduced testcase from comment #9 crashes with -O2 on i686-pc-linux-gnu since GCC 4.4.0, so the problem is not a regression from 4.4.2, but from 4.3.x.
Subject: Bug 43024 Author: jason Date: Mon Feb 15 04:01:10 2010 New Revision: 156766 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156766 Log: PR c++/43024 * g++.dg/opt/ice1.C: New. Added: trunk/gcc/testsuite/g++.dg/opt/ice1.C Modified: trunk/gcc/testsuite/ChangeLog
Testcase added to testsuite, thanks a lot.
Subject: Bug 43024 Author: jiez Date: Fri Mar 26 14:30:49 2010 New Revision: 157750 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157750 Log: 2010-03-26 Volker Reichelt <reichelt@gcc.gnu.org> PR c++/43024 * g++.dg/opt/ice1.C: New. Added: branches/gcc-4_4-branch/gcc/testsuite/g++.dg/opt/ice1.C Modified: branches/gcc-4_4-branch/gcc/testsuite/ChangeLog