I have defined a type in a module as:
TYPE::CHARARRAY
sequence
CHARACTER*32 NAME
CHARACTER(LEN=:),ALLOCATABLE :: CA(:)
INTEGER VTYPE
INTEGER NLEN
END TYPE
TYPE(CHARARRAY),ALLOCATABLE:: UDCA(:)
I then allocate the array as:
ALLOCATE(UDCA(NUDCASIZE),STAT=ERR)
THen the string CA as:
ALLOCATE(CHARACTER(LEN=CLEN)::UDCA(NUMUDCA+1)%CA(NSIZE),STAT=ERR)
Where CLEN, NUMUDCA, and NSIZE are all integers defined at runtime.
Looking at this in the debugger shows CA as an udefined pointer, but ERR=0 and checking ALLOCATED(UDCA(NUMUDCA+1)%CA) don't show any errors. The code seems to be able to set the string and print it out again. But using it as an argument to a subroutine crashes:
CALL SAVUDCA(NREC,UDCA(I)%CA,UDCA(I)%NLEN,NFILE)
Any idea why?
RUnning with PSXE2016