The following code in a submodule does not link with PGI 19.10 on Linux:
submodule(moduleA) submoduleA
implicit none
type :: tType
integer :: i
end type tType
type(tType), allocatable, dimension(:) :: x
type(tType) :: y
real, allocatable, dimension(:) :: z
contains
subroutine submoduleA_init
print*, 'submoduleA_init'
allocate(x(5)) ! this does not work
x(1)%i = 1
y%i = 1
allocate(z(5))
end subroutine submoduleA_init
end submodule submoduleA
The error is
/usr/bin/ld: CMakeFiles/main.dir/submoduleA.f90.o: in function `modulea__submodulea_submodulea_init_':
/home/m/Desktop/PGI_error/submodule-allocate-type/src/submoduleA.f90:15: undefined reference to `modulea__submodulea_ttype_td_'
/usr/bin/ld: /home/m/Desktop/PGI_error/submodule-allocate-type/src/submoduleA.f90:15: undefined reference to `modulea__submodulea_ttype_td_'
I’ve created a minimal working example (consists of several files, including a shell script for compilation) and uploaded it to https://cloud.martin-diehl.net/index.php/s/wG6spbDSYkwAotg.
If someone from PGI has downloaded it or if you are not interested, please let me know because I want to delete the link