https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114646
Bug ID: 114646
Summary: libgfortran doesn't work with static libpthread
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libfortran
Assignee: unassigned at gcc dot gnu.org
Reporter: hjl.tools at gmail dot com
Target Milestone: ---
[hjl@gnu-cfl-3 tmp]$ cat x.f90
use omp_lib
implicit none
integer, parameter :: NT = 4
integer :: nThreads(NT)
print *, 'Call omp_set_dynamic'
!$ call omp_set_dynamic(.false.)
print *, 'Call omp_set_num_threads'
!$ call omp_set_num_threads(NT)
print *, 'Now enter the parallel region'
!$omp parallel default(none) shared(nThreads)
nThreads(omp_get_thread_num()+1) = omp_get_num_threads()
!$omp end parallel
print*, nThreads
END
[hjl@gnu-cfl-3 tmp]$ gfortran -static -fopenmp x.f90
/usr/local/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/13/libgomp.a(target.o): in
function `gomp_target_init.part.0':
(.text+0x4d6): warning: Using 'dlopen' in statically linked applications
requires at runtime the shared libraries from the glibc version used for
linking
[hjl@gnu-cfl-3 tmp]$ ./a.out
Call omp_set_dynamic
Call omp_set_num_threads
Now enter the parallel region
4 4 4 4
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
Backtrace for this error:
Program received signal SIGABRT: Process abort signal.
Backtrace for this error:
Program received signal SIGABRT: Process abort signal.
Backtrace for this error:
Segmentation fault (core dumped)
[hjl@gnu-cfl-3 tmp]$