User account creation filtered due to spam.

Bug 5661 - Gcc 3.0.3 Seg faults compiling bad code
Summary: Gcc 3.0.3 Seg faults compiling bad code
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.1
: P3 normal
Target Milestone: ---
Assignee: Mark Mitchell
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-02-11 14:16 UTC by adrian.cornish
Modified: 2003-07-25 17:33 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
gccbug.tar.gz (80.41 KB, application/x-gzip )
2003-05-21 15:16 UTC, adrian.cornish
Details

Note You need to log in before you can comment on or make changes to this bug.
Description adrian.cornish 2002-02-11 14:16:02 UTC
Gcc seg faults compiling following error message:-
adrian@falcon:/home/adrian/bug> g++ -v -save-temps t.cpp
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.3/specs
Configured with: ../configure 
Thread model: single
gcc version 3.0.3
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.3/cpp0 -lang-c++ -D__GNUG__=3 -D__GXX_DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -v -iprefix /usr/bin/../lib/gcc-lib/i686-pc-linux-gnu/3.0.3/ -D__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=3 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ t.cpp t.ii
GNU CPP version 3.0.3 (cpplib) (i386 Linux/ELF)
ignoring nonexistent directory "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.3/../../../../include/g++-v3"
ignoring nonexistent directory "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.3/../../../../include/g++-v3/i686-pc-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.3/../../../../include/g++-v3/backward"
ignoring nonexistent directory "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.3/include"
ignoring nonexistent directory "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.3/../../../../i686-pc-linux-gnu/include"
ignoring nonexistent directory "/usr/local/i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include/g++-v3
 /usr/local/include/g++-v3/i686-pc-linux-gnu
 /usr/local/include/g++-v3/backward
 /usr/local/include
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.3/include
 /usr/include
End of search list.
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.3/cc1plus -fpreprocessed t.ii -quiet -dumpbase t.cpp -version -o t.s
GNU CPP version 3.0.3 (cpplib) (i386 Linux/ELF)
GNU C++ version 3.0.3 (i686-pc-linux-gnu)
        compiled by GNU C version 3.0.3.
t.cpp: In instantiation of `std::_Vector_base<int[((A::Max - 1) + 1)], std::allocator<int[((A::Max - 1) + 1)]> >':
t.cpp:8:   instantiated from `std::vector<int[((A::Max - 1) + 1)], std::allocator<int[((A::Max - 1) + 1)]> >'
t.cpp:8:   instantiated from here
t.cpp:8: Internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

Release:
Gcc 3.0.3, 3.1

Environment:
Suse Linux 7.1
Linux 2.2.18-SMP #1 SMP i686 unknown

How-To-Repeat:
Compile t.cpp with:-
g++ t.cpp
Comment 1 adrian.cornish 2002-02-11 14:16:02 UTC
Fix:
http://gcc.gnu.org/ml/gcc-patches/2002-10/msg00723.html
Comment 2 Volker Reichelt 2002-02-12 15:04:20 UTC
From: Reichelt <reichelt@igpm.rwth-aachen.de>
To: adrian.cornish@bluedreamer.com, gcc-gnats@gcc.gnu.org,
        gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org
Cc:  
Subject: Re: c++/5661: Gcc 3.0.3 Seg faults compiling bad code
Date: Tue, 12 Feb 2002 15:04:20 +0100

 Hi,
 
 the problem can be reduced to the following code, which causes an ICE
 with gcc 3.1 20020204 (experimental) on i686-pc-linux-gnu and
 mips-sgi-irix6.5:
 
 -------------------snip here--------------------
 template <class T> struct A
 {
     A() throw() {}
 };
 
 struct B
 {
     static const int s;
     A<int[s]> a;  // illegal, constant value not known
 };
 
 const int B::s=16;
 
 B b;
 -------------------snip here--------------------
 
 The error message is:
 
 PR5661.cpp: In constructor `B::B()':
 PR5661.cpp:14: internal error: Segmentation fault
 Please submit a full bug report, [etc.]
 
 Greetings,
 Volker Reichelt
 
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5661
 
 
Comment 3 Kriang Lerdsuwanakij 2002-05-20 06:58:29 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed.
Comment 4 Mark Mitchell 2002-10-03 22:38:56 UTC
Responsible-Changed-From-To: unassigned->mmitchel
Responsible-Changed-Why: Working on a fix.
Comment 5 Mark Mitchell 2002-10-11 12:59:51 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed in GCC 3.2.1.
Comment 6 Mark Mitchell 2002-10-11 19:55:22 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/5661
Date: 11 Oct 2002 19:55:22 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	mmitchel@gcc.gnu.org	2002-10-11 12:55:22
 
 Modified files:
 	gcc/testsuite  : ChangeLog 
 	gcc/cp         : ChangeLog cp-tree.h decl.c pt.c tree.c 
 Added files:
 	gcc/testsuite/g++.dg/ext: vlm1.C vlm2.C 
 
 Log message:
 	PR c++/5661
 	* cp-tree.h (variably_modified_type_p): New function.
 	(grokdeclarator) Tighten check for variably modified types as
 	fields.
 	* pt.c (convert_template_argument): Do not allow variably modified
 	types as template arguments.
 	* tree.c (variably_modified_type_p): New function.
 	
 	PR c++/5661
 	* g++.dg/ext/vlm1.C: New test.
 	* g++.dg/ext/vlm2.C: Likewise.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2134&r2=1.2135
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/vlm1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/vlm2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.2994&r2=1.2995
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.757&r2=1.758
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.947&r2=1.948
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.623&r2=1.624
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/tree.c.diff?cvsroot=gcc&r1=1.303&r2=1.304
 

Comment 7 Mark Mitchell 2002-10-11 19:55:22 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/5661
Date: 11 Oct 2002 19:55:22 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	mmitchel@gcc.gnu.org	2002-10-11 12:55:22
 
 Modified files:
 	gcc/testsuite  : ChangeLog 
 	gcc/cp         : ChangeLog cp-tree.h decl.c pt.c tree.c 
 Added files:
 	gcc/testsuite/g++.dg/ext: vlm1.C vlm2.C 
 
 Log message:
 	PR c++/5661
 	* cp-tree.h (variably_modified_type_p): New function.
 	(grokdeclarator) Tighten check for variably modified types as
 	fields.
 	* pt.c (convert_template_argument): Do not allow variably modified
 	types as template arguments.
 	* tree.c (variably_modified_type_p): New function.
 	
 	PR c++/5661
 	* g++.dg/ext/vlm1.C: New test.
 	* g++.dg/ext/vlm2.C: Likewise.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2134&r2=1.2135
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/vlm1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/vlm2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.2994&r2=1.2995
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.757&r2=1.758
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.947&r2=1.948
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.623&r2=1.624
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/tree.c.diff?cvsroot=gcc&r1=1.303&r2=1.304
 
Comment 8 Mark Mitchell 2002-10-11 22:42:21 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/5661
Date: 11 Oct 2002 22:42:21 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	mmitchel@gcc.gnu.org	2002-10-11 15:42:21
 
 Modified files:
 	gcc/cp         : ChangeLog cp-tree.h decl.c pt.c tree.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/ext: vlm1.C vlm2.C 
 
 Log message:
 	PR c++/5661
 	* g++.dg/ext/vlm1.C: New test.
 	* g++.dg/ext/vlm2.C: Likewise.
 	
 	PR c++/5661
 	* cp-tree.h (variably_modified_type_p): New function.
 	(grokdeclarator) Tighten check for variably modified types as
 	fields.
 	* pt.c (convert_template_argument): Do not allow variably modified
 	types as template arguments.
 	* tree.c (variably_modified_type_p): New function.
 
 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.18&r2=1.2685.2.114.2.19
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.681.2.12.2.4&r2=1.681.2.12.2.5
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.866.2.36.2.5&r2=1.866.2.36.2.6
 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.4&r2=1.578.2.11.2.5
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/tree.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.268.2.7&r2=1.268.2.7.2.1
 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.22&r2=1.1672.2.166.2.23
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/vlm1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.2.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/vlm2.C.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.2.1
 

Comment 9 Mark Mitchell 2002-10-11 22:42:21 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/5661
Date: 11 Oct 2002 22:42:21 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	mmitchel@gcc.gnu.org	2002-10-11 15:42:21
 
 Modified files:
 	gcc/cp         : ChangeLog cp-tree.h decl.c pt.c tree.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/ext: vlm1.C vlm2.C 
 
 Log message:
 	PR c++/5661
 	* g++.dg/ext/vlm1.C: New test.
 	* g++.dg/ext/vlm2.C: Likewise.
 	
 	PR c++/5661
 	* cp-tree.h (variably_modified_type_p): New function.
 	(grokdeclarator) Tighten check for variably modified types as
 	fields.
 	* pt.c (convert_template_argument): Do not allow variably modified
 	types as template arguments.
 	* tree.c (variably_modified_type_p): New function.
 
 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.18&r2=1.2685.2.114.2.19
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.681.2.12.2.4&r2=1.681.2.12.2.5
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.866.2.36.2.5&r2=1.866.2.36.2.6
 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.4&r2=1.578.2.11.2.5
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/tree.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.268.2.7&r2=1.268.2.7.2.1
 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.22&r2=1.1672.2.166.2.23
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/vlm1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.2.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/vlm2.C.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.2.1