Bug 859203 - gcc internal compiler error: segmentation fault
gcc internal compiler error: segmentation fault
Status: CLOSED UPSTREAM
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
17
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Jakub Jelinek
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-20 15:27 EDT by Kyle Liddell
Modified: 2012-09-21 05:49 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-09-21 05:49:53 EDT
Type: Bug
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 to trigger bug (160 bytes, text/x-c++src)
2012-09-20 15:27 EDT, Kyle Liddell
no flags Details
c++ source to trigger bug (286 bytes, text/x-chdr)
2012-09-20 15:27 EDT, Kyle Liddell
no flags Details
c++ source to trigger bug (101 bytes, text/x-chdr)
2012-09-20 15:28 EDT, Kyle Liddell
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
GNU Compiler Collection 54652 None None None Never

  None (edit)
Description Kyle Liddell 2012-09-20 15:27:26 EDT
Created attachment 615080 [details]
c++ source to trigger bug

Description of problem:
When compiling slightly messy C++ source, g++ segfaults when generating code with debugging symbols.
I found this bug while working on a C++ project, and I was able to strip down the code to a minimal (52 line) test case.  Note that in the main.cpp file, if you take out any of the useless header includes, the error doesn't occur.  Or, if you comment out the typedef in inc.h, you also avoid the error.

I have tested this on Fedora 17 on i686 and x86_64, and on Fedora 15 on x86_64.

Version-Release number of selected component (if applicable):
gcc-c++-4.7.0-5.fc17.x86_64 ( gcc version 4.7.0 20120507 (Red Hat 4.7.0-5) (GCC) )
gcc-c++-4.6.3-2.fc15.x86_64 ( gcc version 4.6.3 20120306 (Red Hat 4.6.3-2) (GCC) )
gcc-c++-4.7.0-5.fc17.i686 ( gcc version 4.7.0 20120507 (Red Hat 4.7.0-5) (GCC) )

How reproducible:
always

Steps to Reproduce:
On an x86_64 system:
g++ -m64 -c -o main.o main.cpp -I. -g   #segfault
g++ -m64 -c -o main.o main.cpp -I.      #compiles without error
g++ -m32 -c -o main.o main.cpp -I. -g   #error but no segfault
g++ -m32 -c -o main.o main.cpp -I.      #error but no segfault

On an i686 system:
g++ -m32 -c -o main.o main.cpp -I. -g   #segfault
g++ -m32 -c -o main.o main.cpp -I.      #compiles without error
  
Actual results:
For example, on the x86_64 system, after running
g++ -m64 -c -o main.o main.cpp -I. -g :

In file included from main.cpp:5:0:
inc.h: In instantiation of ‘union badclass<int>::buggystuff_u’:
inc.h:11:8:   required from ‘class badclass<int>’
main.cpp:7:15:   required from here
inc.h:9:12: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/ccDlvEg5.out file, please attach this to your bugreport.

When the compiler exits with an error message, here's the output.  (This is from x86_64, with -m32 -g )
In file included from main.cpp:5:0:
inc.h: In instantiation of ‘union badclass<int>::buggystuff_u’:
inc.h:11:8:   required from ‘class badclass<int>’
main.cpp:7:15:   required from here
inc.h:10:10: error: ‘badclass<T>::buggystuff_u::asdf’ has incomplete type
inc.h:9:12: error: declaration of ‘union badclass<int>::buggystuff_u’

Expected results:
clean compilation or an error message.

Additional info:
I don't have a machine available to generate 64bit code from a 32bit system, so I can't test that configuration.
Comment 1 Kyle Liddell 2012-09-20 15:27:56 EDT
Created attachment 615081 [details]
c++ source to trigger bug
Comment 2 Kyle Liddell 2012-09-20 15:28:33 EDT
Created attachment 615082 [details]
c++ source to trigger bug
Comment 3 Jakub Jelinek 2012-09-21 05:49:53 EDT
Handling upstream.

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