Bug 485153

Summary: static build with gcc-4.4 crash and kernel note the error
Product: [Fedora] Fedora Reporter: Havard Rue <hrue>
Component: gcc4Assignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact:
Severity: urgent Docs Contact:
Priority: low    
Version: rawhide   
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-02-12 17:23:59 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
The script to run the testcase
none
The C-file for the test-case
none
The fortranfile for the test-case none

Description Havard Rue 2009-02-11 21:46:10 UTC
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 09:57:34 UTC
Please provide the source you are compiling and the options used, binary is unsufficient.

Comment 2 Havard Rue 2009-02-12 15:02:27 UTC
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 15:03:11 UTC
Created attachment 331697 [details]
The C-file for the test-case

Comment 4 Havard Rue 2009-02-12 15:03:40 UTC
Created attachment 331698 [details]
The fortranfile for the test-case

Comment 5 Havard Rue 2009-02-12 15:08:20 UTC
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 16:12:15 UTC
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 17:23:59 UTC
Yes, that fix it ;-)