Bug 112353 - 'internal error: Segmentation fault' compiling C++ file
'internal error: Segmentation fault' compiling C++ file
Status: CLOSED WONTFIX
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
8.0
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-12-18 03:56 EST by Ed Avis
Modified: 2007-04-18 13:00 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-01-12 04:23:13 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)
C++ source code to reproduce gcc segfault (5.50 KB, text/plain)
2003-12-18 03:56 EST, Ed Avis
no flags Details

  None (edit)
Description Ed Avis 2003-12-18 03:56:15 EST
Compiling the attached C++ source file segfaults gcc.  Save the file
as test.C and compile:

% gcc -c test.C
line-map.c: file "/usr/include/c++/3.2/string" left but not entered
line-map.c: file "/usr/include/c++/3.2/cstddef" left but not entered
line-map.c: file "/usr/include/c++/3.2/cstring" left but not entered
line-map.c: file "/usr/include/string.h" left but not entered
line-map.c: file "/usr/include/c++/3.2/cstring" left but not entered
line-map.c: file "/usr/include/_G_config.h" left but not entered
line-map.c: file "/usr/include/_G_config.h" left but not entered
line-map.c: file "/usr/include/libio.h" left but not entered
line-map.c: file "/usr/include/sched.h" left but not entered
line-map.c: file "/usr/include/signal.h" left but not entered
line-map.c: file "/usr/include/pthread.h" left but not entered
line-map.c: file
"/usr/include/c++/3.2/i386-redhat-linux/bits/gthr-default.h" left but
not entered
/usr/include/pthread.h: In function `int __gthread_active_p()':
/usr/include/pthread.h:-79: internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions.


The negative line number in the final error message is also interesting.

% gcc --version
gcc (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

% rpm -q gcc gcc-c++
gcc-3.2-7
gcc-c++-3.2-7

The source file is reasonably minimal; if you remove any one line then
the segfault no longer occurs.
Comment 1 Ed Avis 2003-12-18 03:56:58 EST
Created attachment 96599 [details]
C++ source code to reproduce gcc segfault
Comment 2 Jakub Jelinek 2004-01-12 04:23:13 EST
The file has completely messed up the # [num] lines,
certainly this is not as generated by the compiler but incorrectly
edited.
If I do:
grep -v '^# [0-9]*' test.C > test2.C
gcc -c test2.C
test2.C:223: ISO C++ forbids declaration of `__gthread_active_p' with no type
test2.C:225: syntax error at end of input

which is expected and correct.
The segfault happens because of the incorrect line markers, simply don't do that.
Comment 3 Ed Avis 2004-01-12 07:28:16 EST
The segmentation fault did occur with a real C++ source file; I went
to some trouble to reduce the file to a minimal test case, in the
belief that any segmentation fault or memory trampling counts as a bug.

Once I had created the minimal test case I deleted the original large
file... I thought that sending a smaller file would help you diagnose
the problem more effectively.  Oh well.

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