09/02/22 00:56:09
program mtest
integer, allocatable :: imem(:)
msize = 1000*1000 * 200
call alloc4i(imem, msize)
c :
stop
end
subroutine alloc4i(imem, msize)
integer, allocatable :: imem(:)
if ( .not. allocated(imem) ) then
allocate( imem(msize), stat=ier )
if (ier .ne. 0) stop
else
stop
endif
return
end
こんな感じでメモリ割付をするサブルーチンを作りたいのですが、サブルーチン側の
配列宣言でコンパイルエラーになってしまいます。このように親側でallocatableにした
配列は、サブルーチン側でどのようにallocateするのでしょうか?