Bug 28465 - [gomp] Statically linked OpenMP Fortran programs cause segment fault
Summary: [gomp] Statically linked OpenMP Fortran programs cause segment fault
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.2.0
: P3 major
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-24 00:58 UTC by Canqun Yang
Modified: 2006-07-24 19:46 UTC (History)
2 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Canqun Yang 2006-07-24 00:58:12 UTC
All statically linked OpenMP Fortran programs cause segment fault when executed on i686-pc-linux-gnu platform.
Comment 1 Andrew Pinski 2006-07-24 01:03:13 UTC
This is a bug in glibc I think, can you get a backtrace?  Also what version of glibc are you using?  Also static linking is on its way out for glibc in general which is why I would not doubt this is a bug in glibc.
Comment 2 Francois-Xavier Coudert 2006-07-24 19:29:04 UTC
> All statically linked OpenMP Fortran programs cause segment fault when executed
> on i686-pc-linux-gnu platform.

To help making further progress on this PR, could you report the different glibc version numbers on which you experienced that bug? It works fine for me with RedHat's glibc-2.4-8 and Debian testing glibc 2.3.

$ cat hello.f 
      PROGRAM HELLO

      INTEGER NTHREADS, TID, OMP_GET_NUM_THREADS,
     +        OMP_GET_THREAD_NUM

C     Fork a team of threads giving them their own copies of variables
!$OMP PARALLEL PRIVATE(NTHREADS, TID)


C     Obtain thread number
      TID = OMP_GET_THREAD_NUM()
      PRINT *, 'Hello World from thread = ', TID

C     Only master thread does this
      IF (TID .EQ. 0) THEN
        NTHREADS = OMP_GET_NUM_THREADS()
        PRINT *, 'Number of threads = ', NTHREADS
      END IF

C     All threads join master thread and disband
!$OMP END PARALLEL

      END
quatramaran /tmp $ ./irun/bin/gfortran -static hello.f -fopenmp
quatramaran /tmp $ file ./a.out                                
./a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux
 2.4.1, statically linked, for GNU/Linux 2.4.1, not stripped
$ OMP_NUM_THREADS=4 ./a.out                   
 Hello World from thread =            0
 Number of threads =            4
 Hello World from thread =            1
 Hello World from thread =            2
 Hello World from thread =            3
Comment 3 Andrew Pinski 2006-07-24 19:46:27 UTC
This is a bug in glibc with TLS and static linking.  It has been fixed already in newer glibcs.