Bug 42225 - [4.5 Regression] GCC 4.5 ICE (segfault) on C++ templated code
Summary: [4.5 Regression] GCC 4.5 ICE (segfault) on C++ templated code
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.5.0
: P1 normal
Target Milestone: 4.5.0
Assignee: Dodji Seketeli
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2009-11-30 04:14 UTC by Benoit Jacob
Modified: 2009-12-21 18:59 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.4.2
Known to fail:
Last reconfirmed: 2009-12-11 22:12:03


Attachments
Preprocessed C++ source triggering this ICE (166.93 KB, application/x-bzip)
2009-11-30 04:17 UTC, Benoit Jacob
Details
Draft patch (711 bytes, patch)
2009-12-11 22:47 UTC, Dodji Seketeli
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benoit Jacob 2009-11-30 04:14:16 UTC
Hi,

I ran into a ICE (segmentation fault) with GCC 4.5 (20091126) when building some C++ templated code. The platform is GNU/Linux, x86-64.

Please find attached the preprocessed source:

   product_small.ii.bz2

I have compressed it because it was really huge (this codes uses a C++ template library).

Below is the compiler output for the g++ that generated that .ii file. Scroll to the end to see the ICE.


##### 22:58:34 ~/build/eigen/test$ /usr/bin/g++-4.5 -v -save-temps -DHAS_GSL -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NO_DEBUG -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fexceptions -fno-check-new -fno-common -fstrict-aliasing -Wextra -pedantic  -g2 -g0 -O2  -fno-inline-functions -I/home/bjacob/build/eigen/test -I/home/bjacob/eigen/test -I/home/bjacob/eigen -I/home/bjacob/build/eigen -I/usr/include/QtGui -I/usr/include/QtCore    -DEIGEN_TEST_FUNC=product_small  -DEIGEN_TEST_PART_1=1 -o CMakeFiles/test_product_small_1.dir/product_small.cpp.o -c /home/bjacob/eigen/test/product_small.cpp                                                 
Using built-in specs.                                                           
COLLECT_GCC=/usr/bin/g++-4.5                                                    
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/lto-wrapper     
Target: x86_64-unknown-linux-gnu                                                
Configured with: ../configure --prefix=/usr --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-lto --enable-gnu-unique-object --disable-multilib --disable-libstdcxx-pch --with-tune=generic --with-system-zlib --with-ppl --with-cloog --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --disable-werror --enable-checking=release --program-suffix=-4.5 --enable-version-specific-runtime-libs  
Thread model: posix                                                               
gcc version 4.5.0 20091126 (experimental) (GCC)                                   
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-DHAS_GSL' '-DQT_DLL' '-DQT_GUI_LIB' '-DQT_CORE_LIB' '-DQT_NO_DEBUG' '-Wnon-virtual-dtor' '-Wno-long-long' '-ansi' '-Wundef' '-Wcast-align' '-Wchar-subscripts' '-Wall' '-W' '-Wpointer-arith' '-Wwrite-strings' '-Wformat-security' '-fexceptions' '-fno-check-new' '-fno-common' '-fstrict-aliasing' '-Wextra' '-pedantic' '-g2' '-g0' '-O2' '-fno-inline-functions' '-I/home/bjacob/build/eigen/test' '-I/home/bjacob/eigen/test' '-I/home/bjacob/eigen' '-I/home/bjacob/build/eigen' '-I/usr/include/QtGui' '-I/usr/include/QtCore' '-DEIGEN_TEST_FUNC=product_small' '-DEIGEN_TEST_PART_1=1' '-o' 'CMakeFiles/test_product_small_1.dir/product_small.cpp.o' '-c' '-shared-libgcc' '-mtune=generic'                   
 /usr/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/cc1plus -E -quiet -v -I/home/bjacob/build/eigen/test -I/home/bjacob/eigen/test -I/home/bjacob/eigen -I/home/bjacob/build/eigen -I/usr/include/QtGui -I/usr/include/QtCore -D_GNU_SOURCE -DHAS_GSL -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NO_DEBUG -DEIGEN_TEST_FUNC=product_small -DEIGEN_TEST_PART_1=1 /home/bjacob/eigen/test/product_small.cpp -mtune=generic -ansi -Wnon-virtual-dtor -Wno-long-long -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wextra -pedantic -fexceptions -fno-check-new -fno-common -fstrict-aliasing -fno-inline-functions -O2 -fpch-preprocess -o product_small.ii                                                              
ignoring nonexistent directory "/usr/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../x86_64-unknown-linux-gnu/include"                                           
#include "..." search starts here:                                                
#include <...> search starts here:                                                
 /home/bjacob/build/eigen/test                                                    
 /home/bjacob/eigen/test                                                          
 /home/bjacob/eigen                                                               
 /home/bjacob/build/eigen                                                         
 /usr/include/QtGui                                                               
 /usr/include/QtCore                                                              
 /usr/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/include/c++                          
 /usr/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/include/c++/x86_64-unknown-linux-gnu 
 /usr/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/include/c++/backward                 
 /usr/local/include                                                               
 /usr/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/include                              
 /usr/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/include-fixed                        
 /usr/include                                                                     
End of search list.                                                               
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-DHAS_GSL' '-DQT_DLL' '-DQT_GUI_LIB' '-DQT_CORE_LIB' '-DQT_NO_DEBUG' '-Wnon-virtual-dtor' '-Wno-long-long' '-ansi' '-Wundef' '-Wcast-align' '-Wchar-subscripts' '-Wall' '-W' '-Wpointer-arith' '-Wwrite-strings' '-Wformat-security' '-fexceptions' '-fno-check-new' '-fno-common' '-fstrict-aliasing' '-Wextra' '-pedantic' '-g2' '-g0' '-O2' '-fno-inline-functions' '-I/home/bjacob/build/eigen/test' '-I/home/bjacob/eigen/test' '-I/home/bjacob/eigen' '-I/home/bjacob/build/eigen' '-I/usr/include/QtGui' '-I/usr/include/QtCore' '-DEIGEN_TEST_FUNC=product_small' '-DEIGEN_TEST_PART_1=1' '-o' 'CMakeFiles/test_product_small_1.dir/product_small.cpp.o' '-c' '-shared-libgcc' '-mtune=generic'
 /usr/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/cc1plus -fpreprocessed product_small.ii -quiet -dumpbase product_small.cpp -mtune=generic -ansi -auxbase-strip CMakeFiles/test_product_small_1.dir/product_small.cpp.o -g2 -g0 -O2 -Wnon-virtual-dtor -Wno-long-long -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wextra -pedantic -ansi -version -fexceptions -fno-check-new -fno-common -fstrict-aliasing -fno-inline-functions -o product_small.s
GNU C++ (GCC) version 4.5.0 20091126 (experimental) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.5.0 20091126 (experimental), GMP version 4.3.1, MPFR version 2.4.1, MPC version 0.8
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (GCC) version 4.5.0 20091126 (experimental) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.5.0 20091126 (experimental), GMP version 4.3.1, MPFR version 2.4.1, MPC version 0.8
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: b74b35577b24604a564e27e0e25efd13
In file included from /home/bjacob/eigen/test/product_small.cpp:26:0:
/home/bjacob/eigen/test/product.h: In function ‘void product(const MatrixType&) [with MatrixType = Eigen::Matrix<float, 3, 2, 0>]’:
/home/bjacob/eigen/test/product_small.cpp:31:97:   instantiated from here
/home/bjacob/eigen/test/product.h:45:60: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Benoit Jacob 2009-11-30 04:17:23 UTC
Created attachment 19181 [details]
Preprocessed C++ source triggering this ICE

To uncompress do:
  bunzip2 product_small.ii.bz2
Comment 2 Richard Biener 2009-11-30 10:32:43 UTC
With checking enabled I get

> g++-4.5 -S -o /dev/null product_small.ii -B /abuild/rguenther/trunk-g/gcc
In file included from /home/bjacob/eigen/test/product_small.cpp:26:0:
/home/bjacob/eigen/test/product.h: In function 'void product(const MatrixType&) [with MatrixType = Eigen::Matrix<float, 3, 2, 0>]':
/home/bjacob/eigen/test/product_small.cpp:31:97:   instantiated from here
/home/bjacob/eigen/test/product.h:45:60: internal compiler error: tree check: accessed elt 2 of tree_vec with 1 elts in tsubst, at cp/pt.c:9823
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

works with 4.4.2.
Comment 3 Dodji Seketeli 2009-12-01 00:26:26 UTC
A reduced test case seems to be:

~=~
template<class T>
struct A
{
    typedef T I;
};

template<class T, int>
struct B
{   
    typedef T TT;
    typedef typename TT::I TT_I;
    typedef A<TT_I> TA;
};  

template<class T>
void  
foo() 
{
    typedef T TT;
    typedef typename TT::I TT_I;
    typedef A<TT_I> TA;
}

int
main ()
{
    foo<A<int> >();
}
~=~

It ICEs with:
test.cc:27:18:   instantiated from here
test.cc:21:21: internal compiler error: tree check: accessed elt 2 of tree_vec with 1 elts in tsubst, at cp/pt.c:9823
Comment 4 H.J. Lu 2009-12-01 00:27:58 UTC
It is caused by revision 145440:

http://gcc.gnu.org/ml/gcc-cvs/2009-04/msg00060.html
Comment 5 Dodji Seketeli 2009-12-03 14:07:35 UTC
A patch was submitted to http://gcc.gnu.org/ml/gcc-patches/2009-12/msg00194.html
Comment 6 Dodji Seketeli 2009-12-11 14:36:25 UTC
Subject: Bug 42225

Author: dodji
Date: Fri Dec 11 14:36:05 2009
New Revision: 155160

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155160
Log:
Fix PR c++/42225

gcc/cp/ChangeLog:
	PR c++/42225
	* typeck.c (incompatible_dependent_typedefs_p): New function.
	(structural_comptypes): Use it.
	* cp-tree.h (cp_set_underlying_type): Declare ...
	* tree.c (cp_set_underlying_type): ... new function.
	* class.c (build_self_reference): Use cp_set_underlying_type
	instead of set_underlying_type.
	* decl2.c (grokfield): Likewise.
	* name-lookup.c (pushdecl_maybe_friend): Likewise.

gcc/testsuite/ChangeLog:
	PR c++/42225
	* g++.dg/template/typedef24.C: New test.
	* g++.dg/template/typedef25.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/template/typedef24.C
    trunk/gcc/testsuite/g++.dg/template/typedef25.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/class.c
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/decl2.c
    trunk/gcc/cp/name-lookup.c
    trunk/gcc/cp/tree.c
    trunk/gcc/cp/typeck.c
    trunk/gcc/testsuite/ChangeLog

Comment 7 Dodji Seketeli 2009-12-11 14:37:22 UTC
Fixed in trunk (4.5)
Comment 8 Benoit Jacob 2009-12-11 17:07:21 UTC
(In reply to comment #7)
> Fixed in trunk (4.5)
> 

Thanks for fixing this bug!

Maybe I'm just ignorant, but I can't get the fix to work for me. I have SVN r155167. I am still getting a ICE, albeit at a slightly different line number now:

##### 12:01:44 ~/build/eigen$ make product_small_1
Building CXX object test/CMakeFiles/product_small_1.dir/product_small.cpp.o
In file included from /home/bjacob/eigen/test/product_small.cpp:26:0:
/home/bjacob/eigen/test/product.h: In function ‘void product(const MatrixType&) [with MatrixType = Eigen::Matrix<float, 3, 2, 0>]’:
/home/bjacob/eigen/test/product_small.cpp:31:5:   instantiated from here
/home/bjacob/eigen/test/product.h:45:60: internal compiler error: tree check: accessed elt 2 of tree_vec with 1 elts in tsubst, at cp/pt.c:9822
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 9 Benoit Jacob 2009-12-11 17:10:59 UTC
I also confirm that I still have the ICE with the .ii file attached to this bug report.
Comment 10 H.J. Lu 2009-12-11 17:24:06 UTC
Confirmed.
Comment 11 Dodji Seketeli 2009-12-11 22:12:03 UTC
Hah. It looks like there are several slightly different problems at play here. Apparently I just fixed one of them, which I was the one I narrowed in the reduced test case above.
Then I forgot to try my fix on the initial test case attached to the bug. I only tried on the reduced test case. Sorry about that.

Here is, I think, a reduced test case for this particular issue:

struct A
{
    static const int i = 1;
    typedef int TI;
};

template<class T0>
struct S0
{
    int i;
};

template<class _T, int>
struct S1
{
    typedef _T T;
    typedef typename T::TI TTI;
    typedef S0<TTI> TT0;
};

template<class T>
void
foo(const T&)
{
    typedef typename T::TI TTI;
    typedef S0<TTI> TT1;
}
   
int   
main()
{
    A a;
    foo (a);
}


I am currently testing a patch and this time I tested it first on the initial testcase :-)
Comment 12 Dodji Seketeli 2009-12-11 22:47:22 UTC
Created attachment 19278 [details]
Draft patch

Here is the patch I am testing.
It seems to be working fine so far.
Note that g++ says the code is not valid though. Did you expect it to compile without error ?
Comment 13 Benoit Jacob 2009-12-11 22:51:23 UTC
(In reply to comment #12)
> Note that g++ says the code is not valid though. Did you expect it to compile
> without error ?

The .ii file I have attached? Yes, I was expecting it to be correct, it compiles without error or warnings with GCC 4.4, even with all warnings enabled, AFAIK.


Comment 14 hjl@gcc.gnu.org 2009-12-11 23:38:05 UTC
Subject: Bug 42225

Author: hjl
Date: Fri Dec 11 23:36:24 2009
New Revision: 155184

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155184
Log:
Backport testcases from trunk.

2009-12-11  H.J. Lu  <hongjiu.lu@intel.com>

	Backport from mainline:
	2009-12-11  Dodji Seketeli  <dodji@redhat.com>

	PR c++/42225
	* g++.dg/template/typedef24.C: New test.
	* g++.dg/template/typedef25.C: New test.

	2009-12-11  Dodji Seketeli  <dodji@redhat.com>

	PR c++/42251
	* g++.dg/template/const3.C: New test.

	2009-12-10  Jakub Jelinek  <jakub@redhat.com>

	PR c++/42317
	* g++.dg/opt/dtor2.C: New test.
	* g++.dg/opt/dtor2.h: New file.
	* g++.dg/opt/dtor2-aux.cc: New file.

	2009-12-10  Jan Hubicka  <jh@suse.cz>

	PR middle-end/42110
	* g++.dg/torture/pr42110.C: new file.

	2009-12-07  Jakub Jelinek  <jakub@redhat.com>

	PR debug/42244
	* gcc.dg/debug/pr42244.c: New test.

	2009-12-04  David Daney  <ddaney@caviumnetworks.com>

	PR rtl-optimization/42164
	* gcc.c-torture/compile/pr42164.c: New test.

	2009-12-03  Jason Merrill  <jason@redhat.com>

	PR c++/41611
	* g++.dg/abi/guard2.C: New.

	2009-12-03  Dodji Seketeli  <dodji@redhat.com>

	PR c++/42217
	* g++.dg/other/bitfield4.C: New test.

	2009-12-03  Jakub Jelinek  <jakub@redhat.com>

	PR c++/42256
	* g++.dg/inherit/thunk11.C: New test.
	* g++.dg/inherit/thunk11.h: New file.
	* g++.dg/inherit/thunk11-aux.cc: New file.

	2009-12-01  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/42237
	* gcc.c-torture/compile/pr42237.c: New test.

	2009-12-01  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/42057
	* g++.dg/parse/crash54.C: New.

	2009-11-30  Martin Jambor  <mjambor@suse.cz>

	PR middle-end/42196
	* gcc.c-torture/compile/pr42196-1.c: New test.
	* gcc.c-torture/compile/pr42196-2.c: New test.
	* gcc.c-torture/compile/pr42196-3.c: New test.

	2009-11-30  Dodji Seketeli  <dodji@redhat.com>

	PR c++/42069
	* g++.dg/template/typedef23.C: New test.

	2009-11-29  H.J. Lu  <hongjiu.lu@intel.com>

	PR tree-optimization/41961
	* g++.dg/tree-ssa/pr41961.C: New.

	2009-11-29  Ira Rosen  <irar@il.ibm.com>

	PR tree-optimization/42193
	* gcc.dg/vect/pr42193.c: New test.

	2009-11-28  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/42183
	* g++.dg/torture/pr42183.C: New testcase.

	2009-11-27  Martin Jambor  <mjambor@suse.cz>

	PR middle-end/42006
	* gcc.c-torture/execute/pr42006.c: New test.

	2009-11-27  Michael Matz  <matz@suse.de>

	PR rtl-optimization/42084
	* gcc.dg/pr42084.c: New test.

	2009-11-27  Michael Matz  <matz@suse.de>

	PR c++/41906
	* g++.dg/tree-ssa/pr41906.C: New testcase.

	2009-11-26  Michael Matz  <matz@suse.de>

	PR tree-optimization/41905
	* g++.dg/tree-ssa/pr41905.C: New testcase.

	2009-11-24  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/42142
	* gcc.c-torture/execute/pr42142.c: New testcase.

	2009-11-24  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/42154
	* gcc.c-torture/execute/pr42154.c: New test.

	2009-11-21  Martin Jambor  <mjambor@suse.cz>

	PR middle-end/42025
	* gcc.c-torture/compile/pr42025-1.c: New test.
	* gcc.c-torture/compile/pr42025-2.c: New test.

	2009-11-21  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/42078
	* gcc.dg/pr42078.c: New test.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/abi/guard2.C
      - copied unchanged from r155170, trunk/gcc/testsuite/g++.dg/abi/guard2.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/inherit/thunk11-aux.cc
      - copied unchanged from r155170, trunk/gcc/testsuite/g++.dg/inherit/thunk11-aux.cc
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/inherit/thunk11.C
      - copied unchanged from r155170, trunk/gcc/testsuite/g++.dg/inherit/thunk11.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/inherit/thunk11.h
      - copied unchanged from r155170, trunk/gcc/testsuite/g++.dg/inherit/thunk11.h
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/opt/dtor2-aux.cc
      - copied unchanged from r155170, trunk/gcc/testsuite/g++.dg/opt/dtor2-aux.cc
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/opt/dtor2.C
      - copied unchanged from r155170, trunk/gcc/testsuite/g++.dg/opt/dtor2.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/opt/dtor2.h
      - copied unchanged from r155170, trunk/gcc/testsuite/g++.dg/opt/dtor2.h
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/other/bitfield4.C
      - copied unchanged from r155170, trunk/gcc/testsuite/g++.dg/other/bitfield4.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/parse/crash54.C
      - copied unchanged from r155172, trunk/gcc/testsuite/g++.dg/parse/crash54.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/template/const3.C
      - copied unchanged from r155170, trunk/gcc/testsuite/g++.dg/template/const3.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/template/typedef23.C
      - copied unchanged from r155181, trunk/gcc/testsuite/g++.dg/template/typedef23.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/template/typedef24.C
      - copied unchanged from r155170, trunk/gcc/testsuite/g++.dg/template/typedef24.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/template/typedef25.C
      - copied unchanged from r155170, trunk/gcc/testsuite/g++.dg/template/typedef25.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr42110.C
      - copied unchanged from r155170, trunk/gcc/testsuite/g++.dg/torture/pr42110.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr42183.C
      - copied unchanged from r155181, trunk/gcc/testsuite/g++.dg/torture/pr42183.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/tree-ssa/pr41905.C
      - copied unchanged from r155182, trunk/gcc/testsuite/g++.dg/tree-ssa/pr41905.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/tree-ssa/pr41906.C
      - copied unchanged from r155182, trunk/gcc/testsuite/g++.dg/tree-ssa/pr41906.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/tree-ssa/pr41961.C
      - copied unchanged from r155181, trunk/gcc/testsuite/g++.dg/tree-ssa/pr41961.C
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42025-1.c
      - copied unchanged from r155182, trunk/gcc/testsuite/gcc.c-torture/compile/pr42025-1.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42025-2.c
      - copied unchanged from r155182, trunk/gcc/testsuite/gcc.c-torture/compile/pr42025-2.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42164.c
      - copied unchanged from r155170, trunk/gcc/testsuite/gcc.c-torture/compile/pr42164.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42196-1.c
      - copied unchanged from r155181, trunk/gcc/testsuite/gcc.c-torture/compile/pr42196-1.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42196-2.c
      - copied unchanged from r155181, trunk/gcc/testsuite/gcc.c-torture/compile/pr42196-2.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42196-3.c
      - copied unchanged from r155181, trunk/gcc/testsuite/gcc.c-torture/compile/pr42196-3.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42237.c
      - copied unchanged from r155171, trunk/gcc/testsuite/gcc.c-torture/compile/pr42237.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/execute/pr42006.c
      - copied unchanged from r155181, trunk/gcc/testsuite/gcc.c-torture/execute/pr42006.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/execute/pr42142.c
      - copied unchanged from r155182, trunk/gcc/testsuite/gcc.c-torture/execute/pr42142.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/execute/pr42154.c
      - copied unchanged from r155182, trunk/gcc/testsuite/gcc.c-torture/execute/pr42154.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/debug/pr42244.c
      - copied unchanged from r155170, trunk/gcc/testsuite/gcc.dg/debug/pr42244.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr42078.c
      - copied unchanged from r155182, trunk/gcc/testsuite/gcc.dg/pr42078.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr42084.c
      - copied unchanged from r155182, trunk/gcc/testsuite/gcc.dg/pr42084.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/vect/pr42193.c
      - copied unchanged from r155181, trunk/gcc/testsuite/gcc.dg/vect/pr42193.c
Modified:
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog

Comment 15 Dodji Seketeli 2009-12-14 08:24:36 UTC
(In reply to comment #13)
> The .ii file I have attached? Yes, I was expecting it to be correct, it
> compiles without error or warnings with GCC 4.4, even with all warnings
> enabled, AFAIK.

Fair enough. It was me doing weird things.

I submitted a patch to http://gcc.gnu.org/ml/gcc-patches/2009-12/msg00669.html
Let's see how it turns out.

Thanks for your feedback.

Comment 16 Benoit Jacob 2009-12-14 12:43:19 UTC
(In reply to comment #15)
> Fair enough. It was me doing weird things.
> 
> I submitted a patch to http://gcc.gnu.org/ml/gcc-patches/2009-12/msg00669.html
> Let's see how it turns out.
> 
> Thanks for your feedback.
> 

Thanks for your responsiveness! The whole Eigen team is very pleased about this.

By the way, this bug report comes from trying to build the Eigen test suite (development branch). This is a great real-world use case for mixing very complate C++ template stuff with other specific topics such as SSE intrinsics, etc. If you want to test it yourself, install CMake and Mercurial, and do:

   $ hg clone https://bitbucket.org/eigen/eigen/
   $ mkdir eigen-build
   $ cd eigen-build
   $ cmake ../eigen
   $ make check

I mention this because I heared that GCC has a list of project it builds before releasing a version, as real-world test cases. Maybe Eigen's test suite can be added to that list? Maybe after we make the next release? (The current stable release, 2.0, didn't trigger this GCC error).
Comment 17 Richard Biener 2009-12-14 13:03:17 UTC
(In reply to comment #16)
> I mention this because I heared that GCC has a list of project it builds before
> releasing a version, as real-world test cases. Maybe Eigen's test suite can be
> added to that list? Maybe after we make the next release? (The current stable
> release, 2.0, didn't trigger this GCC error).

Nah, we don't do this anymore (well, testing a specific list of projects).
Instead we rely on the community providing feedback during development.

Richard.
Comment 18 Dodji Seketeli 2009-12-19 22:40:50 UTC
Subject: Bug 42225

Author: dodji
Date: Sat Dec 19 22:40:37 2009
New Revision: 155363

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155363
Log:
Fix PR c++/42225, take 2

gcc/cp/ChangeLog:
	PR c++/42225
	* pt.c (push_template_decl_real): Set DECL_CONTEXT of template type
	parms to their containing template decl.
	* typeck.c (comp_template_parms_position): Split this from
	structural_comptypes.
	(incompatible_template_type_parms_p): Renamed
	incompatible_dependent_typedefs_p into this. Change the function to
	handle comparison between TEMPLATE_TYPE_PARMs only.
	(structural_comptypes): Use comp_template_parms_position in
	TEMPLATE_TEMPLATE_PARM and BOUND_TEMPLATE_TEMPLATE_PARM cases.
	Use incompatible_template_type_parms_p in TEMPLATE_TYPE_PARM case.
	* mangle.c (decl_mangling_context): Template type parms don't have
	a mangling context.
	* tree.c (cp_set_underlying_type): Set type structural equality
	only for TEMPLATE_TYPE_PARMs.

gcc/testsuite/ChangeLog:
	PR c++/42225
	* g++.dg/template/typedef26.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/template/typedef26.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/mangle.c
    trunk/gcc/cp/pt.c
    trunk/gcc/cp/tree.c
    trunk/gcc/cp/typeck.c
    trunk/gcc/testsuite/ChangeLog

Comment 19 Dodji Seketeli 2009-12-19 22:43:52 UTC
This should now be fixed in trunk for 4.5
Comment 20 Benoit Jacob 2009-12-21 18:59:09 UTC
Thank you, I can confirm that it's fixed here.

However I now hit another ICE, see bug #42450, but it seems unrelated.
Comment 21 hjl@gcc.gnu.org 2009-12-22 18:18:16 UTC
Subject: Bug 42225

Author: hjl
Date: Tue Dec 22 18:17:53 2009
New Revision: 155403

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155403
Log:
Backport testcases from mainline.

2009-12-22  H.J. Lu  <hongjiu.lu@intel.com>

	Backport from mainline:
	2009-12-19  Dodji Seketeli  <dodji@redhat.com>

	PR c++/42225
	* g++.dg/template/typedef26.C: New test.

	2009-12-17  Jakub Jelinek  <jakub@redhat.com>

	PR c++/42386
	* g++.dg/opt/dtor3.C: New test.

	2009-12-15  Jason Merrill  <jason@redhat.com>

	PR c++/42358
	* g++.dg/cpp0x/variadic98.C: New.

	2009-12-13  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/42357
	* g++.dg/torture/pr42357.C: New testcase.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/variadic98.C
      - copied unchanged from r155402, trunk/gcc/testsuite/g++.dg/cpp0x/variadic98.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/opt/dtor3.C
      - copied unchanged from r155402, trunk/gcc/testsuite/g++.dg/opt/dtor3.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/template/typedef26.C
      - copied unchanged from r155402, trunk/gcc/testsuite/g++.dg/template/typedef26.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr42357.C
      - copied unchanged from r155402, trunk/gcc/testsuite/g++.dg/torture/pr42357.C
Modified:
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog