Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 584871 - GCC 4.4.3 crash when compiling C++ source code
GCC 4.4.3 crash when compiling C++ source code
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
12
x86_64 Linux
low Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-04-22 11:42 EDT by Lee
Modified: 2010-04-27 06:15 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-04-27 06:15:54 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Lee 2010-04-22 11:42:46 EDT
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 04:49:37 EDT
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 08:34:50 EDT
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
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Comment 3 Lee 2010-04-26 09:29:02 EDT
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 09:36:04 EDT
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 10:26:37 EDT
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 10:39:09 EDT
Created attachment 409193 [details]
Sets.ii file attached

Sets.ii file attached.
Comment 7 Jakub Jelinek 2010-04-26 11:38:46 EDT
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 03:40:30 EDT
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 03:58:26 EDT
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 03:59:11 EDT
Created attachment 409394 [details]
attached another Sets.ii

Hopefully a better Sets.ii file.
Comment 11 Jakub Jelinek 2010-04-27 06:15:54 EDT
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.