the following sample shows that ifort rejects pointer rank remapping within a FORALL construct. Simple pointer assignments seems to work, though.
program p implicit none type ta integer, pointer :: ip1(:) integer, pointer :: ip2(:,:) end type ta type tb integer, pointer :: ip2(:,:) end type tb type(ta), allocatable :: z(:) type(tb), allocatable :: y(:) integer :: i, n1=2, n2=2 allocate (y(10),z(10)) do i = 1,10 y(i)% ip2(1:n1,1:n2) => z(i)% ip1 end do do, concurrent (i=1:10) y(i)% ip2(1:n1,1:n2) => z(i)% ip1 end do forall (i=1:10) y(i)% ip2(1:n1,1:n2) => z(i)% ip1 ! Rejected ! y(i)% ip2 => z(i)% ip2 ! This would be accepted end forall end
ifort 2021.7.0 gives:
ifort-forall.f90(24): error #6697: The leftside of a forall-assignment is invalid. [IP2] y(i)% ip2(1:n1,1:n2) => z(i)% ip1 ! Rejected -----------^ compilation aborted for ifort-forall.f90 (code 1)
NAG 7.1 accepts the code without any complaint.
No more erroneous error message for this reproducer for either ifort or ifx. Try the Fortran compilers in oneAPI 2023.1 that were released this week.