Bug 18121 - [4.0 regression] ICE with array type
Summary: [4.0 regression] ICE with array type
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.0
: P2 critical
Target Milestone: 4.0.0
Assignee: Drea Pinski
URL:
Keywords: ice-on-valid-code, patch
Depends on:
Blocks:
 
Reported: 2004-10-23 01:17 UTC by Volker Reichelt
Modified: 2004-10-25 13:28 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2004-10-23 01:32:11


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2004-10-23 01:17:29 UTC
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.
Comment 1 Drea Pinski 2004-10-23 01:32:11 UTC
: 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.
Comment 2 Drea Pinski 2004-10-23 18:20:08 UTC
Mine, I am testing a patch for this right now.
Comment 3 Drea Pinski 2004-10-23 19:05:55 UTC
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.
Comment 4 GCC Commits 2004-10-25 13:27:38 UTC
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

Comment 5 Drea Pinski 2004-10-25 13:28:42 UTC
Fixed.