I recently started to use procedure pointers and it all worked fine. Now however, I get a segmentation fault when checking if one of those pointer is associated ONLY when it is null (i.e. no error when said pointer is associated).
I built a MCVE but this example code runs fine in all conditions, so there's no point posting it here. I am then thinking the error might be somewhere else in the code. Here is my original code:
module mms
!***************
!some code
!***************
procedure(template_get_rho ), pointer :: get_rho => null()
interface
function template_get_rho(x1, x2, time) result(rho)
import :: dp
implicit none
real(dp), intent(in) :: time
real(dp), dimension(0:), intent(in) :: x1, x2
real(dp), allocatable, dimension(:,:) :: rho
end function
end interface
!***************
!some code
!***************
contains
subroutine initialize_mms
select case(mms_case)
case(1)
!***************
!some code, get_rho is NOT associated to anything
!***************
case(2)
get_rho => prob2_get_rho
end select
!nullify(get_rho) <------------------------ Error here when uncommented
!get_rho => null() <-------- No errors here
if(associated(get_rho)) then <------------------ Error here when get_rho set to null()
rho(0:nx-1, 0:ny-1) = get_rho(x, y, time)
end if
end subroutine
!************
! some code
!************
end module mms
|
For Any idea what I'm doing wrong? I am using mpiifort 4.1.3.048 with the following debug flags:
|