Bug 51533 - ICE on legal(?) code
Summary: ICE on legal(?) code
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 7.1
Hardware: i686
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
Depends On:
TreeView+ depends on / blocked
Reported: 2001-08-11 23:06 UTC by Dimitri Papadopoulos
Modified: 2007-04-18 16:35 UTC (History)
0 users

Clone Of:
Last Closed: 2004-10-05 18:41:48 UTC

Attachments (Terms of Use)
Preprocessed file. Compile to reproduce ICE. (238.70 KB, text/plain)
2001-08-11 23:08 UTC, Dimitri Papadopoulos
no flags Details

Description Dimitri Papadopoulos 2001-08-11 23:06:23 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.4.3-12smp i686)

Description of problem:
I get an ICE:

	$ g++ -c bug.i
	/home/papadopo/shfj-main/include/shfj/smart/rcptr.h: In instantiation of
	TEST.cc:23:   instantiated from `shfj::rc_ptr<Foo>'
	TEST.cc:23:   instantiated from here
	/home/papadopo/shfj-main/include/shfj/smart/rcptr.h:67: Internal error:
Segmentation fault.
	Please submit a full bug report.
	See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions.

on the following code:

	template <typename T>
	class default_storage
		template <class Y> friend default_storage;
		typedef T* stored_type;
		typedef T* pointer_type;
		typedef T& reference_type;

Remove this line
	template <class Y> friend default_storage;
and the compiler does not crash anymore.

How reproducible:

Steps to Reproduce:
1. Compile attached bug.i preprocessed file using g++ -c bug.i
2. See the ICE error message.

Actual Results:  ICE.

Expected Results:  Compile.

Additional info:

Comment 1 Dimitri Papadopoulos 2001-08-11 23:08:00 UTC
Created attachment 27413 [details]
Preprocessed file. Compile to reproduce ICE.

Comment 2 Dimitri Papadopoulos 2001-08-11 23:16:42 UTC
Ooops, it just occured to me that
	template <class Y> friend default_storage;
should be
	template <class Y> friend class default_storage;
thanks to GCC 3.0 which gracefully reports:
	In file included from TEST.cc:13:
	/home/papadopo/shfj-main/include/shfj/smart/rcptr.h:61: friend declaration
	   requires class-key, i.e. `friend class shfj::default_storage<Y>'

Maybe you could have GCC 2.96 avoid the ICE and exit gracefully too.

BTW, I'm using gcc-c++-2.96-85.

Comment 3 Jakub Jelinek 2001-08-20 08:05:03 UTC
Patch added to patch queue for 2.96-97, will be fixed there. Thanks for the report.

Comment 4 Vladimir Makarov 2004-10-05 18:41:48 UTC
gcc-2.96 is too old.  Its release cycle was finished long ago.  Also
Jakub wrote about fixing the bug in gcc-2.96-97.  Therefore I am
closing the case.  If  it is still important we could reopen it.

Note You need to log in before you can comment on or make changes to this bug.