18.10 Fortran associate bug

Hi,

I found an unexpected behavior when using associate for arrays of derived type:

program associate_broken
 implicit none
 integer, dimension(3) :: i
 type :: tParameters
   real, allocatable, dimension(:) :: &
     xi_slip0
 end type tParameters

 type(tParameters),  allocatable, dimension(:) :: param

 
 i = 1
 allocate(param(5))
 associate(prm => param(i(2)))
   allocate(prm%xi_slip0(5))
   print*, allocated(prm%xi_slip0)
   print*, allocated(param(i(2))%xi_slip0)
 end associate

end program

for some reasons, the second print gives F, even though it should be T

Thanks MarDie!

I’ve added a problem report (TPR #27049) and sent it to engineering for further investigation.

-Mat

many thanks!