Bug 485153 - static build with gcc-4.4 crash and kernel note the error
Summary: static build with gcc-4.4 crash and kernel note the error
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc4
Version: rawhide
Hardware: x86_64
OS: Linux
low
urgent
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-02-11 21:46 UTC by Havard Rue
Modified: 2009-02-12 17:23 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-02-12 17:23:59 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
The script to run the testcase (550 bytes, text/plain)
2009-02-12 15:02 UTC, Havard Rue
no flags Details
The C-file for the test-case (157 bytes, text/x-csrc)
2009-02-12 15:03 UTC, Havard Rue
no flags Details
The fortranfile for the test-case (102 bytes, application/octet-stream)
2009-02-12 15:03 UTC, Havard Rue
no flags Details

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 ;-)


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