Bug 25851 - Internal error: Segmentation fault.
Summary: Internal error: Segmentation fault.
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 7.0
Hardware: i686
OS: Linux
medium
high
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-02-03 13:33 UTC by Dimitri Papadopoulos
Modified: 2007-04-18 16:31 UTC (History)
0 users

(edit)
Clone Of:
(edit)
Last Closed: 2001-02-06 16:33:50 UTC


Attachments (Terms of Use)

Description Dimitri Papadopoulos 2001-02-03 13:33:45 UTC
Hi,

Compile the following C code with GCC 2.96 + latest patches:

	void func(void)
	{
	  int i;
	#line 1 "/foo/foo.h"
	  if (1)
	    i = 1;
	  else
	    i
	#line 2
	    = 0;
	}

The compiler will segfault:
	$ gcc -c foo.c
	/foo/foo.h: In function `f':
	/foo/foo.h:2: Internal error: Segmentation fault.
	Please submit a full bug report.
	See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions.

Of course the code is not correct but the compiler should not segfault.

Note: Similar code is generated by KAI C++. This prevents from compiling
with KAI C++ on Red Hat 7, or at least from getting meaningful error
messages from the GCC back-end.

Thanks,
Dimitri

Comment 1 Dimitri Papadopoulos 2001-02-03 13:59:41 UTC
Oh, I see now that the KAI C++ code is _not_ incorrect.
Actually it does not look like the code previously posted.
It looks like this:

	void func(void)
	{
	  int i;
	#line 1 "/foo/foo.h"
	  if (1) i = 1; else i
        #line 1
	    = 0;
	}

The code is really meant to hold in a single line. Now I have read
paragraph 16.4.3 of ISO C++ and it is not very clear what happens
in this special case. Unfortunately I don't have the ISO C standard
available here, so I cannot check in the ISO C standard.

In any case KAI C++ works fine with other compilers so I guess this
should be fixed in GCC.

Dimitri


Comment 2 Jakub Jelinek 2001-02-06 16:33:46 UTC
I've fixed it in my tree, the fix will appear in gcc-2.96-75.


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