possible bug when using omp_set_num_threads with -fno-underscoring
Andreas Breslau
abreslau@mpifr-bonn.mpg.de
Mon Oct 27 09:22:00 GMT 2014
Hi all,
I have found something in gfortran which is at least surprising, more
likely a bug.
Using -fno-underscoring with omp_set_num_threads() followed by a !$OMP
PARALLEL region leads to a Segmentation fault.
(Without a following PARALLEL region it works but is useless... ;-) )
As a work around the trailing "_" can be inserted manually:
omp_set_num_threads_()
Below is a minimal example producing the "surprise".
After compilation with "gfortran -fopenmp -o bsp bsp.f90" the program
works as expected,
after compilation with "gfortran -fopenmp -fno-underscoring -o bsp
bsp.f90" it segfaults.
This happens in the versions 4.8.1 and 4.9.1
Did I miss something or is this unintended?
Greetings from Cologne, Germany
Cheers Andreas Breslau
------------------------------------------------------------
! bsp.f90
program bsp
use omp_lib
implicit none
!$OMP PARALLEL
!$ IF( OMP_GET_THREAD_NUM() .EQ. 0 ) WRITE(*,*) 'Using OpenMP with',
OMP_GET_NUM_THREADS(), 'threads.'
!$OMP END PARALLEL
!$ call omp_set_num_threads(4)
!$OMP PARALLEL
!$ IF( OMP_GET_THREAD_NUM() .EQ. 0 ) WRITE(*,*) 'Using OpenMP with',
OMP_GET_NUM_THREADS(), 'threads.'
!$OMP END PARALLEL
end program bsp
More information about the Fortran
mailing list