https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68227
--- Comment #1 from Gerhard Steinmetz <gerhard.steinmetz.fort...@t-online.de> --- Of course, above code works with : forall (i=1:n) y(i)%a => x But it works too, if above n is replaced with literal value 2 : $ cat y3.f90 program p type t end type type t2 type(t), pointer :: a end type type(t), target :: x type(t2), pointer :: y(:) integer :: i allocate (y(2)) forall (i=1:2) y(i)%a = x ! print *, y(1)%a print *, y(2)%a end $ gfortran -g -O0 -Wall -fcheck=all y3.f90 $ a.out