Bug 16870 - [3.4/4.0 regression] Boost.Spirit causes ICE in tsubst, at cp/pt.c:6629
[3.4/4.0 regression] Boost.Spirit causes ICE in tsubst, at cp/pt.c:6629
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: c++
3.4.1
: P2 critical
: 3.4.2
Assigned To: Mark Mitchell
: ice-on-valid-code, monitored
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2004-08-04 09:20 UTC by Jens Maurer
Modified: 2004-10-30 21:11 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: 3.3.4
Known to fail: 3.4.0 3.4.1 4.0.0
Last reconfirmed: 2004-08-04 12:16:53


Attachments
Program that crashes the compiler. (1.16 KB, text/plain)
2004-08-04 09:21 UTC, Jens Maurer
Details
Preprocessed source for gcc 3.3.3 (works) (266.94 KB, application/x-gzip)
2004-08-04 09:21 UTC, Jens Maurer
Details
Preprocessed source for gcc 3.4.1 (crashes the compiler) (269.39 KB, application/x-gzip)
2004-08-04 09:22 UTC, Jens Maurer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jens Maurer 2004-08-04 09:20:26 UTC
The attached program causes

gcc341_crash.cc:56:   instantiated from here
gcc341_crash.cc:34: internal compiler error: in tsubst, at cp/pt.c:6629

with gcc 3.4.1.

This works with gcc 3.3.3, so it appears to be a regression from 3.3.
I've also attached preprocessed source for both 3.4.1 and 3.3.3.

Jens Maurer
Comment 1 Jens Maurer 2004-08-04 09:21:21 UTC
Created attachment 6877 [details]
Program that crashes the compiler.
Comment 2 Jens Maurer 2004-08-04 09:21:57 UTC
Created attachment 6878 [details]
Preprocessed source for gcc 3.3.3 (works)
Comment 3 Jens Maurer 2004-08-04 09:22:22 UTC
Created attachment 6879 [details]
Preprocessed source for gcc 3.4.1 (crashes the compiler)
Comment 4 Volker Reichelt 2004-08-04 12:16:51 UTC
Confirmed. Here's a shorter example

===============================================
struct A
{
    int operator[](int) const;
};

template<int> A foo();

template<typename T> T bar(T(*)());

template<int> int baz() { return A(bar(&foo<0>))[0]; }

template int baz<0>();
===============================================
Comment 5 Andrew Pinski 2004-08-04 15:29:00 UTC
: Search converges between 2003-07-08-trunk (#288) and 2003-07-09-trunk (#289).
Comment 6 Andrew Pinski 2004-08-04 15:34:08 UTC
Here is another example (removing some templates):
struct A
{
    int operator[](int) const;
};

template<int> A foo();

A bar(A(*)());

template<int> int baz() { return (bar(&foo<0>))[0]; }

template int baz<0>();
Comment 7 CVS Commits 2004-08-12 00:34:40 UTC
Subject: Bug 16870

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	mmitchel@gcc.gnu.org	2004-08-12 00:34:33

Modified files:
	gcc            : ChangeLog 
	gcc/cp         : ChangeLog call.c pt.c 
	gcc/ginclude   : stddef.h 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/init: ptrmem1.C 
	gcc/testsuite/g++.dg/parse: offsetof5.C 
	gcc/testsuite/g++.dg/template: overload3.C 

Log message:
	PR c++/16618
	* ginclude/stddef.h (offsetof): Refine C++ definition.
	
	PR c++/16853
	* call.c (standard_conversion): Do not accept conversions between
	pointers to members if the class types are unrelated.
	
	PR c++/16870
	* pt.c (tsubst): Just return the unknown_type_node.
	
	PR c++/16853
	* g++.dg/init/ptrmem1.C: New test.
	
	PR c++/16618
	* g++.dg/parse/offsetof5.C: New test.
	
	PR c++/16870
	* g++.dg/template/overload3.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.578&r2=2.2326.2.579
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.141&r2=1.3892.2.142
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.452.2.20&r2=1.452.2.21
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.816.2.37&r2=1.816.2.38
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ginclude/stddef.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.20&r2=1.20.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.244&r2=1.3389.2.245
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/ptrmem1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/offsetof5.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/overload3.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1

Comment 8 CVS Commits 2004-08-12 00:43:53 UTC
Subject: Bug 16870

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-08-12 00:43:47

Modified files:
	gcc/cp         : ChangeLog call.c parser.c pt.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/init: ptrmem1.C 
	gcc/testsuite/g++.dg/parse: offsetof5.C 
	gcc/testsuite/g++.dg/template: overload3.C 

Log message:
	PR c++/16853
	* call.c (standard_conversion): Do not accept conversions between
	pointers to members if the class types are unrelated.
	
	PR c++/16618
	* parser.c (cp_parser_builtin_offsetof): Cast to "const volatile
	char &" instead of just "char &".
	
	PR c++/16870
	* pt.c (tsubst): Just return the unknown_type_node.
	
	PR c++/16853
	* g++.dg/init/ptrmem1.C: New test.
	
	PR c++/16618
	* g++.dg/parse/offsetof5.C: New test.
	
	PR c++/16870
	* g++.dg/template/overload3.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4270&r2=1.4271
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&r1=1.498&r2=1.499
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.234&r2=1.235
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.902&r2=1.903
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4119&r2=1.4120
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/ptrmem1.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/offsetof5.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/overload3.C.diff?cvsroot=gcc&r1=1.1&r2=1.2

Comment 9 Mark Mitchell 2004-08-12 00:52:16 UTC
GCC 3.4.2.