I reported the issue at Oct 30, 2019. But I do not get a confirmation since then, so I decide to post it here.
The version of the compiler that I use is pgfortran 19.9-0 LLVM 64-bit target on x86-64 Linux -tp haswell, PGI Compilers and Tools.
I made a very simple test program to demonstrates the issue. It seems that the issue only occur in type-bound procedures when compiled with llvm, i.e. all 19.x version of PGI compiler with default options.
main.F03
program main
use test_interf
implicit none
call g_test%construct()
call g_test%run()
end program main
test_interf.F03
module test_interf
integer, parameter :: NX = 500, NY = 500, NZ = 50
type :: test
real, dimension(:, :, :), allocatable :: m_a
real, dimension(:, :, :), allocatable :: m_b
contains
procedure, pass(this) :: construct => test_construct
procedure, pass(this) :: run => test_run
procedure, pass(this) :: process_a => test_process_a
procedure, pass(this) :: process_b => test_process_b
end type test
type(test) g_test
interface
subroutine test_construct(this)
import :: test
class(test), intent(inout) :: this
end subroutine test_construct
subroutine test_run(this)
import :: test
class(test), intent(inout) :: this
end subroutine test_run
subroutine test_process_a(this)
import :: test
class(test), intent(inout) :: this
end subroutine test_process_a
subroutine test_process_b(this)
import :: test
class(test), intent(inout) :: this
end subroutine test_process_b
end interface
end module test_interf
test_impl.F03
subroutine test_construct(this)
use test_interf, dummy => test_construct
implicit none
class(test), intent(inout) :: this
allocate(this%m_a(NX, NY, NZ), this%m_b(NX, NY, NZ))
call random_number(this%m_a)
call random_number(this%m_b)
end subroutine test_construct
subroutine test_run(this)
use test_interf, dummy => test_run
implicit none
class(test), intent(inout) :: this
!$omp parallel sections num_threads(2)
!$omp section
call this%process_a()
!$omp section
call this%process_b()
!$omp end parallel sections
end subroutine test_run
subroutine test_process_a(this)
use test_interf, dummy => test_process_a
implicit none
class(test), intent(inout) :: this
this%m_a = this%m_a * 1.0e-2
end subroutine test_process_a
subroutine test_process_b(this)
use test_interf, dummy => test_process_b
implicit none
class(test), intent(inout) :: this
this%m_b = this%m_b * 1.0e-3
end subroutine test_process_b
If compiled by pgfortran with llvm, the program crashes. If compiled by pgfortran without llvm, it runs smoothly.