Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be unavailable on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 584871 - GCC 4.4.3 crash when compiling C++ source code
Summary: GCC 4.4.3 crash when compiling C++ source code
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 12
Hardware: x86_64
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2010-04-22 15:42 UTC by Lee
Modified: 2010-04-27 10:15 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2010-04-27 10:15:54 UTC
Type: ---

Attachments (Terms of Use)
abrt log file with stacktrace (998.72 KB, application/octet-stream)
2010-04-22 15:42 UTC, Lee
no flags Details
Sets.ii file attached (140.08 KB, application/x-gzip)
2010-04-26 14:39 UTC, Lee
no flags Details
attached another Sets.ii (140.18 KB, application/x-gzip)
2010-04-27 07:59 UTC, Lee
no flags Details

Description Lee 2010-04-22 15:42:46 UTC
Created attachment 408362 [details]
abrt log file with stacktrace

Description of problem:
GCC compiler crashes when compiler C++ source code

Version-Release number of selected component (if applicable):
GCC 4.4.3

How reproducible:

Steps to Reproduce:
1. download ACE-5.7.8.tar.gz, untar it
2. cd ACE_wrappers,   mkdir build,   cd build,  ../configure
3. make

and then it starts compiling and will then crash the compiler.
Actual results:
compiler crash 

Expected results:
successful compilation or a normal C++ diagnostic error

Additional info:

Comment 1 Jakub Jelinek 2010-04-23 08:49:37 UTC
Please provide preprocessed source.
g++ should normally in such cases for reproduceable crashes prepare a preprocessed source (with command line in a comment) for you and print where it is on stderr, if it did not for whatever reason, please rerun the g++ command
line with additional -save-temps option, mention here the full command line and attach the *.ii file it generates.  Also, the gcc revision with which you can reproduce it is needed (g++ --version or rpm -q gcc-c++).

Comment 2 Lee 2010-04-26 12:34:50 UTC
gcc version number :

$ g++ --version
g++ (GCC) 4.4.3 20100127 (Red Hat 4.4.3-4)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO

Comment 3 Lee 2010-04-26 13:29:02 UTC
Sorry, so far it is refusing to print that preprocessed source to stderr or save it on disk. I think the final command line was (I added -save-temps) :

[lee@neo Containers]$ g++ -DHAVE_CONFIG_H   -I../../../.. -I../../..   -W -Wall -Wpointer-arith  -save-temps -g -O2 -pthread -O3 -MT Sets-Sets.o -MD -MP -MF .deps/Sets-Sets.Tpo -c -o Sets-Sets.o `test -f 'Sets.cpp' || echo '../../../../examples/APG/Containers/'`Sets.cpp
g++: Internal error: Segmentation fault (program cc1plus)
Please submit a full bug report.
See <http://bugzilla.redhat.com/bugzilla> for instructions.

although abrt-gui reports the final command line differently by showing the actual preprocessor process.

Comment 4 Jakub Jelinek 2010-04-26 13:36:04 UTC
There should be Sets.ii in the current directory after this command and that's the file I'd like to see attached here.
You can add -v after -save-temps to let g++ actually print the commands it is executing, you'll see then a cc1plus invocation with -E and -o Sets.ii or something similar and then another one without -E which uses Sets.ii as source.

Comment 5 Lee 2010-04-26 14:26:37 UTC
Thanks, I will try that again.
The -v was interesting to show the proper command line, and I did find this:
no optimization: works
-O2: works
-O3: crashes

Comment 6 Lee 2010-04-26 14:39:09 UTC
Created attachment 409193 [details]
Sets.ii file attached

Sets.ii file attached.

Comment 7 Jakub Jelinek 2010-04-26 15:38:46 UTC
It doesn't even compile (but doesn't crash either):

g++ -S -g -O3 Sets.ii -std=c++0x -W -Wall -Wpointer-arith -pthread 2>&1 | head
Sets.cpp: In member function ‘int SetExample::run()’:
Sets.cpp:27: error: ‘DataElement’ has not been declared
Sets.cpp:31: error: ‘DataElement’ has not been declared
Sets.cpp: In member function ‘int SetExample::runBoundedSet()’:
Sets.cpp:41: error: ‘DataElement’ was not declared in this scope
Sets.cpp:41: error: template argument 1 is invalid
Sets.cpp:41: error: invalid type in declaration before ‘(’ token
Sets.cpp:43: error: expected ‘;’ before ‘elem’
Sets.cpp:46: error: ‘elem’ was not declared in this scope
Sets.cpp:49: error: request for member ‘insert’ in ‘bset’, which is of non-class type ‘int’

And indeed, DataElement isn't defined anywhere in the preprocessed source.

Comment 8 Lee 2010-04-27 07:40:30 UTC
Sorry, that was my fault. GCC is not producing the .ii in the current directory or in .ccache when I use the normal command line from the ACE build. I tried move the code around to make it local to the current directory and must have gotten something wrong. I will try again.

My workaround is to force -O2 for the compilation and then GCC does not crash.

Comment 9 Lee 2010-04-27 07:58:26 UTC
I think the newly attached file will work better, sorry for the previous one.

[lee@neo Containers]$ g++ -S -g -O3 Sets.ii -std=c++0x -W -Wall -Wpointer-arith -pthread 2>&1 | head
g++: Internal error: Segmentation fault (program cc1plus)
Please submit a full bug report.
See <http://bugzilla.redhat.com/bugzilla> for instructions.

Comment 10 Lee 2010-04-27 07:59:11 UTC
Created attachment 409394 [details]
attached another Sets.ii

Hopefully a better Sets.ii file.

Comment 11 Jakub Jelinek 2010-04-27 10:15:54 UTC
This is upstream PR42871, fixed in gcc-4.4.3-7 and above.

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