I have made this program as simple as I can:
module buffers
complex(8), allocatable :: iobuff(:,:)
end module buffers
program useAllocate
use buffers
integer(kind=4) :: rc=0
character(len=16) :: instr
integer(kind=8) :: abwds
integer(kind=4) :: anbs
call get_command_argument(1, instr)
read(instr,*) abwds
call get_command_argument(2, instr)
read(instr,*) anbs
call allocateBuffers(abwds, anbs, rc)
end program
SUBROUTINE allocateBuffers(arg_buff_wds, arg_num_buffs, retcode)
use buffers
IMPLICIT none
integer(kind=8), INTENT(in) :: arg_buff_wds
integer(kind=4), INTENT(in) :: arg_num_buffs
integer(kind=4), INTENT(out) :: retcode
print *,'allocating iobuff ', arg_buff_wds,'X',arg_num_buffs
ALLOCATE(iobuff(arg_buff_wds, arg_num_buffs), stat = retcode)
print *,'iobuff allocated'
print *,'iobuff has shape ',shape(iobuff)
DEALLOCATE(iobuff)
print *,'iobuff freed'
END SUBROUTINE allocateBuffers
It works just fine under an Intel or a GNU build:
> ./a.out 3 3
allocating iobuff 3 X 3
iobuff allocated
iobuff has shape 3 3
iobuff freed
But Cray Fortran, for some reason can't handle the allocate:
> ./a.out 3 3
allocating iobuff 3 X 3
Illegal instruction (core dumped)
Anyone have any idea why?
(NOTES: The complex(8)
type of iobuff
is not the problem; the code fails with the same error no matter what type I define iobuff
to be. Note that the various types of the variables come from the much bigger code I am really trying to understand.)