User account creation filtered due to spam.

Bug 5919 - [3.2/3.3 regression] ICE when passing variable array to template function
Summary: [3.2/3.3 regression] ICE when passing variable array to template function
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.1
: P1 critical
Target Milestone: ---
Assignee: Mark Mitchell
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2002-03-12 04:26 UTC by he
Modified: 2003-07-25 17:33 UTC (History)
3 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description he 2002-03-12 04:26:00 UTC
g++3.0.4 gives an internal compiler error when compiling the
attached code

Release:
3.0.4, 3.1

Environment:
System: Linux marel2023 2.4.9-31.1 #1 Mon Mar 11 06:52:10 EST 2002 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-3.0.4/configure --prefix=/usr/local/gcc3 --enable-threading=posix

How-To-Repeat:
Try to compile the attached code

#include<vector>
#include<algorithm>
 
int main() {
        std::vector<int> v1, v2;
        int score[v1.size()+1][v2.size()+1];
        std::fill(score, score+(v1.size()+1)*(v2.size()+1), 0);
        return 0;
}
Comment 2 Kriang Lerdsuwanakij 2002-05-20 07:23:41 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed.
Comment 3 Volker Reichelt 2002-11-29 14:29:29 UTC
From: Volker Reichelt <reichelt@igpm.rwth-aachen.de>
To: he@marel.is, gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org,
        nobody@gcc.gnu.org
Cc:  
Subject: Re: c++/5919: [3.2/3.3 regression] ICE when passing variable array to template function
Date: Fri, 29 Nov 2002 14:29:29 +0100

 Here's a reduced testcase:
 
 -------------------------snip here------------------
 template<typename T> void foo(T);
 
 void bar()
 {
     int i;
     int A[i][i];
     foo(A);
 }
 -------------------------snip here------------------
 
 It crashes gcc 3.0.x, 3.2-branch and mainline.
 gcc 2.95.3 issued a regular error message.
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5919
 
 
Comment 4 Mark Mitchell 2002-12-01 10:32:37 UTC
Responsible-Changed-From-To: unassigned->mmitchel
Responsible-Changed-Why: Working on a fix.
Comment 5 Mark Mitchell 2002-12-01 12:47:45 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed in GCC 3.2.2, GCC 3.3.
Comment 6 Mark Mitchell 2002-12-01 20:46:09 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/5919
Date: 1 Dec 2002 20:46:09 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	mmitchel@gcc.gnu.org	2002-12-01 12:46:09
 
 Modified files:
 	gcc/cp         : ChangeLog pt.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/template: varmod1.C 
 
 Log message:
 	PR c++/5919
 	* g++.dg/template/varmod1.C: New test.
 	
 	PR c++/5919
 	* pt.c (unify): Use variably_modified_type_p to test validity of
 	template argument types.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3062&r2=1.3063
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.633&r2=1.634
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2244&r2=1.2245
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/varmod1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 

Comment 7 Mark Mitchell 2002-12-01 20:46:09 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/5919
Date: 1 Dec 2002 20:46:09 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	mmitchel@gcc.gnu.org	2002-12-01 12:46:09
 
 Modified files:
 	gcc/cp         : ChangeLog pt.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/template: varmod1.C 
 
 Log message:
 	PR c++/5919
 	* g++.dg/template/varmod1.C: New test.
 	
 	PR c++/5919
 	* pt.c (unify): Use variably_modified_type_p to test validity of
 	template argument types.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3062&r2=1.3063
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.633&r2=1.634
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2244&r2=1.2245
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/varmod1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 

Comment 8 Mark Mitchell 2002-12-01 20:52:56 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/5919
Date: 1 Dec 2002 20:52:56 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	mmitchel@gcc.gnu.org	2002-12-01 12:52:56
 
 Modified files:
 	gcc/cp         : ChangeLog pt.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/template: varmod1.C 
 
 Log message:
 	PR c++/5919
 	* g++.dg/template/varmod1.C: New test.
 	
 	PR c++/5919
 	* pt.c (unify): Use variably_modified_type_p to test validity of
 	template argument types.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.2685.2.114.2.47&r2=1.2685.2.114.2.48
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.578.2.11.2.5&r2=1.578.2.11.2.6
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.1672.2.166.2.62&r2=1.1672.2.166.2.63
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/varmod1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.2.1
 

Comment 9 Mark Mitchell 2002-12-01 20:52:56 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/5919
Date: 1 Dec 2002 20:52:56 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	mmitchel@gcc.gnu.org	2002-12-01 12:52:56
 
 Modified files:
 	gcc/cp         : ChangeLog pt.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/template: varmod1.C 
 
 Log message:
 	PR c++/5919
 	* g++.dg/template/varmod1.C: New test.
 	
 	PR c++/5919
 	* pt.c (unify): Use variably_modified_type_p to test validity of
 	template argument types.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.2685.2.114.2.47&r2=1.2685.2.114.2.48
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.578.2.11.2.5&r2=1.578.2.11.2.6
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.1672.2.166.2.62&r2=1.1672.2.166.2.63
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/varmod1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.2.1