Bug 51533

Summary: ICE on legal(?) code
Product: [Retired] Red Hat Linux Reporter: Dimitri Papadopoulos <dpo>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED NEXTRELEASE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1   
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-10-05 18:41:48 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Preprocessed file. Compile to reproduce ICE. none

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
`shfj::default_storage<Foo>':
	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;
	protected:
		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:
Always

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.