All statically linked OpenMP Fortran programs cause segment fault when executed on i686-pc-linux-gnu platform.
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.
> 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
This is a bug in glibc with TLS and static linking. It has been fixed already in newer glibcs.