null pointer error on entry to subroutine

What does the following error mean? I’m getting this error when I’m
trying to call a subroutine with the following interface:

0: Null pointer for tmp$r1 (/data/svn_workspace/cmm/ORBSTATS/src/orbit_stats.f90: 183)

The argument qa_orbits is declared as a
TYPE(VDATA_TYPE), DIMENSION(:), POINTER :: ORBIT_KEY_LIST

in the calling program and at the time when it’s trying to call
FILL_FILE_LIST, it’s unallocated. Is this the problem?

What’s the recommended way of passing an uninitialized array pointer
into a subroutine? When I tried adding the “pointer” attribute to the dummy argument in the subroutine it wouldn’t compile, saying it
conflicted with the intent, even if I put the intent to (inout).

!***********************************************************
SUBROUTINE FILL_FILE_LIST(PGE_FILE, FILE_PRODUCT, FILE_LIST, &
ORBIT_KEY, QA_ATTRS, QA_ORBITS, &
NORBITS_EXIST, ISTAT_FILE, &
STRING_ERRORS)
!***********************************************************

USE STRUCTURES, ONLY: FILELIST_TYPE, VDATA_TYPE, QAMETA_TYPE
USE HDF_UTILITY, ONLY: GET_FILE_ATTRIBS

IMPLICIT NONE

CHARACTER(LEN=), INTENT(IN) :: PGE_FILE,FILE_PRODUCT
TYPE(FILELIST_TYPE), INTENT(INOUT) :: FILE_LIST
CHARACTER(LEN=
), INTENT(INOUT) :: STRING_ERRORS
TYPE(VDATA_TYPE), INTENT(OUT) :: ORBIT_KEY
TYPE(QAMETA_TYPE), INTENT(INOUT) :: QA_ATTRS
TYPE(VDATA_TYPE), DIMENSION(:), INTENT(IN) :: QA_ORBITS

BTW, I’m using the pgf90 compiler. Should I switch to pgf95?
Does pgf95 allow me to pass an unallocated array into a subroutine
as dimension(:), allocatable?

Catherine

Hi Catherine,

Looks like it complains about tmp variable. How are vdata_type and tmp defined?

You can pass the unallocated pointer, here is example, though it’s not error proof.

module mytype
type mynode
integer:: my_int
end type mynode
end module

module me
use mytype
contains

subroutine testme(orbit,orbit_2)
implicit none
type(mynode) , intent(inout):: orbit
type(mynode) , pointer, intent(inout):: orbit_2
type(mynode) , target :: orbit_too

orbit_too%my_int=3
orbit_2=>orbit_too

print *, “ORBIT”, orbit%my_int
print *, “ORBIT”, orbit_2%my_int

end
end module

program test
use me
use mytype
type(mynode), pointer:: mylist
type(mynode), pointer:: mylist_2

allocate(mylist)
mylist%my_int=2

call testme(mylist,mylist_2)

end

Hongyon