Bug 485153 - static build with gcc-4.4 crash and kernel note the error
static build with gcc-4.4 crash and kernel note the error
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: gcc4 (Show other bugs)
rawhide
x86_64 Linux
low Severity urgent
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-02-11 16:46 EST by Havard Rue
Modified: 2009-02-12 12:23 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-02-12 12:23:59 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)
The script to run the testcase (550 bytes, text/plain)
2009-02-12 10:02 EST, Havard Rue
no flags Details
The C-file for the test-case (157 bytes, text/x-csrc)
2009-02-12 10:03 EST, Havard Rue
no flags Details
The fortranfile for the test-case (102 bytes, application/octet-stream)
2009-02-12 10:03 EST, Havard Rue
no flags Details

  None (edit)
Description Havard Rue 2009-02-11 16:46:10 EST
Description of problem:

I built my program, static, with the new gcc-4.4 from rawhide amd the program crash when calling exit(). I have installed the fedora 11alpha from rawhide today.


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

gcc version 4.4.0 20090206 (Red Hat 4.4.0-0.16) (GCC) 


How reproducible:

each time

Steps to Reproduce:
1. download binary http://www.math.ntnu.no/~hrue/hfiles/gcc.fail
2. run it
3. it seg.fault
  
Actual results:

seg.fault

Expected results:

run as normal

Additional info:

it does not happen without the -static.

Here is the binary, where the main program just call exit(0) after starting,

http://www.math.ntnu.no/~hrue/hfiles/gcc.fail

my rpms:

http://www.math.ntnu.no/~hrue/hfiles/rpms

Curiously, the seg.fault is also picked up by the kernel

localhost[~]$ ~/www/www.imf/hfiles/gcc.fail 
Segmentation fault (core dumped)
localhost[~]$ tail -n1 /var/log/messages
Feb 11 22:44:30 localhost kernel: gcc.fail[15804]: segfault at 0 ip (null) sp 00007ffff4d55268 error 14 in gcc.fail[400000+9df000]
Comment 1 Jakub Jelinek 2009-02-12 04:57:34 EST
Please provide the source you are compiling and the options used, binary is unsufficient.
Comment 2 Havard Rue 2009-02-12 10:02:27 EST
Created attachment 331696 [details]
The script to run the testcase

The script to run the test case, like:

localhost[tmp]$ sh ./makeme 
  This is a() with i =            0
DYNAMIC OK:: FLAGS = -g
  This is a() with i =            0
STATIC OK:: FLAGS = -g
  This is a() with i =            0
DYNAMIC OK:: FLAGS = -g -fopenmp 
  This is a() with i =            0
./makeme: line 3: 32317 Segmentation fault      (core dumped) ./a.out $arg
STATIC FAIL:: FLAGS = -g -fopenmp
Comment 3 Havard Rue 2009-02-12 10:03:11 EST
Created attachment 331697 [details]
The C-file for the test-case
Comment 4 Havard Rue 2009-02-12 10:03:40 EST
Created attachment 331698 [details]
The fortranfile for the test-case
Comment 5 Havard Rue 2009-02-12 10:08:20 EST
The test-case above seems to fail in the same way and produce for me similar line the /var/log/messages

Feb 12 16:07:45 localhost kernel: a.out[32675]: segfault at 0 ip (null) sp 00007fffe0c4f208 error 14 in a.out[400000+ca000]
Comment 6 Jakub Jelinek 2009-02-12 11:12:15 EST
Ah, -static with OpenMP or generally with threaded programs, don't do that or force linking whole -lpthread:
-Wl,--whole-archive -lpthread -Wl,--no-whole-archive

Does that fix it?
Comment 7 Havard Rue 2009-02-12 12:23:59 EST
Yes, that fix it ;-)

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