The following valid code snippet causes a segfault on mainline: =================================== template<int> struct A { static int const i = 1; }; template<int N> struct B { typedef int (*p)[A<N>::i]; }; =================================== According to Phil's regression hunter we have: : Search converges between 2004-05-11-trunk (#454) and 2004-05-14-trunk (#455). So this was probably introduced by the tree-ssa merge.
: Search converges between 2003-12-16-ssa (#155) and 2003-12-17-ssa (#156). Yes we now try to layout the type even if we are in a template for array types. I will try to fix this soon. This is related to a C example which fails on IA64.
Mine, I am testing a patch for this right now.
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-10/msg01986.html> which reverts the fix for PR middle-end/12920 and fixes PR middle-end/12920 right and also fixes PR middle-end/17407.
Subject: Bug 18121 CVSROOT: /cvs/gcc Module name: gcc Changes by: pinskia@gcc.gnu.org 2004-10-25 13:27:33 Modified files: gcc : ChangeLog c-decl.c tree.c gcc/cp : ChangeLog decl.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: array8.C gcc/testsuite/gcc.c-torture/compile: pr17407.c Log message: 2004-10-25 Andrew Pinski <pinskia@physics.uc.edu> PR middle-end/17407 * c-decl.c (grokdeclarator) <case cdk_array>: Remove the call layout_type as it is already done by build_array_type. * tree.c (build_array_type): Layout the type even 2004-10-25 Andrew Pinski <pinskia@physics.uc.edu> PR c++/18121 * decl.c (grokdeclarator) <case cdk_array>: Remove the call layout_type as it is already done by create_array_type_for_decl. 2004-10-25 Andrew Pinski <pinskia@physics.uc.edu> PR middle-end/17407 * gcc.c-torture/compile/pr17407.c: New test. PR c++/18121 * g++.dg/template/array8.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.6006&r2=2.6007 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&r1=1.603&r2=1.604 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.c.diff?cvsroot=gcc&r1=1.439&r2=1.440 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4452&r2=1.4453 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1317&r2=1.1318 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4492&r2=1.4493 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/array8.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/pr17407.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
Fixed.