Bug 51533 - ICE on legal(?) code
ICE on legal(?) code
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2001-08-11 19:06 EDT by Dimitri Papadopoulos
Modified: 2007-04-18 12:35 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-10-05 14:41:48 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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

  None (edit)
Description Dimitri Papadopoulos 2001-08-11 19:06:23 EDT
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 19:08:00 EDT
Created attachment 27413 [details]
Preprocessed file. Compile to reproduce ICE.
Comment 2 Dimitri Papadopoulos 2001-08-11 19:16:42 EDT
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 04:05:03 EDT
Patch added to patch queue for 2.96-97, will be fixed there. Thanks for the report.
Comment 4 Vladimir Makarov 2004-10-05 14:41:48 EDT
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.