Bug 25851 - Internal error: Segmentation fault.
Internal error: Segmentation fault.
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
7.0
i686 Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-02-03 08:33 EST by Dimitri Papadopoulos
Modified: 2007-04-18 12:31 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-02-06 11:33:50 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Dimitri Papadopoulos 2001-02-03 08:33:45 EST
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 08:59:41 EST
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 11:33:46 EST
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.