Created attachment 22011 [details] testcase Compiler output: $ gcc -flto testcase.C testcase.C:106:1: internal compiler error: tree code 'template_type_parm' is not supported in gimple streams Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. Tested revisions: r165241 - crash r165220 - crash r165152 - OK
We are writing DECL_CONTEXT of a TYPE_DECL which is a RECORD_TYPE which is not instantiated. We should probably simply clear all fields of RECORD_TYPEs which are "incomplete" this way. A more radical approach would be to do for TYPE_FIELDS what we do now for BLOCK_SUBBLOCKS and BLOCK_VARS - write them lazily (but given that they are possibly shared between multiple instances of RECORD_TYPEs re-constructing the field list isn't really possible). I have a patch.
*** Bug 45960 has been marked as a duplicate of this bug. ***
Mine.
Author: jason Date: Mon Oct 11 13:25:37 2010 New Revision: 165306 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=165306 Log: PR lto/45959 PR lto/45960 * pt.c (tsubst_copy) [INTEGER_CST]: Instantiate the type. Added: trunk/gcc/testsuite/g++.dg/lto/20101010-1_0.C trunk/gcc/testsuite/g++.dg/lto/20101010-2_0.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/pt.c trunk/gcc/testsuite/ChangeLog
Fixed.
Actually, this isn't a regression -- not on 4.6, at least. The following minimal test case makes x86_64-unknown-linux-gnu-gcc-4.5.1 die with the same error message: $ cat > lto-bug.h <<EOF #pragma interface template<class T> struct foo; template<class T> struct foo<T*&> : foo<T&> { foo<T*&>(T* t) : foo<T&>(*t) { } }; EOF $ cat > lto-bug.C <<EOF #pragma implementation "lto-bug.h" #include "lto-bug.h" EOF $ gcc-4.5.1 -flto lto-bug.C In file included from lto-bug.C:2:0: lto-bug.h:6:2: internal compiler error: tree code ‘template_type_parm’ is not supported in gimple streams Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. Removing anything at all makes the ICE disappear I don't have a copy of the 4.6 sources to test whether the just checked-in fix takes care of this... reopen?
(In reply to comment #6) > #pragma interface > template<class T> struct foo; > template<class T> > struct foo<T*&> : foo<T&> { > foo<T*&>(T* t) : foo<T&>(*t) { } > }; This looks like a different bug that just produces the same error message. This testcase works fine with pre-4.6, and is not fixed in 4.5 by the patch for 45959.