https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79182
Bug ID: 79182
Summary: when use openmp and link static libgfortran,open
function cause SIGSEGV
Product: gcc
Version: 6.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: hwliu11 at hotmail dot com
Target Milestone: ---
Test File
program savedata
implicit none
integer ncpu,thread_num
integer OMP_GET_NUM_THREADS
external OMP_SET_NUM_THREADS_8_
external OMP_GET_NUM_THREADS
open(50,file='/home/test',status='old',form='formatted',err=999)
write(*,*) "finish"
999 write(*,*) "open error"
ncpu=4
call OMP_SET_NUM_THREADS_8_(ncpu)
!$omp parallel
!$omp& shared (ncpu)
!$omp single
thread_num=OMP_GET_NUM_THREADS()
write(*,*) "thread num ", thread_num
!$omp end single
!$omp end parallel
end program savedata
c
-Wall -fopenmp -fbackslash -g -fcray-pointer -fno-sign-zero -fno-underscoring
-Wline-truncation -fbacktrace -ffpe-summary=none
link options
-fopenmp -static-libgfortran -static -static-libgcc
runtime error
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
Backtrace for this error:
#0 0x4039DE in _gfortrani_backtrace
#1 0x403340 in _gfortrani_backtrace_handler
#2 0x43F0BF in __nptl_death_event