-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Open
Labels
Description
Consider the following reducer:
PROGRAM main
IMPLICIT NONE
TYPE :: DT
CLASS(DT), POINTER :: Ptr(:) => NULL()
END TYPE
TYPE, EXTENDS(DT) :: DT1
END TYPE
TYPE(DT1), TARGET :: Tar1(100)
CLASS(DT), POINTER :: T(:)
integer :: I
ALLOCATE(T(10))
!DO I = 1, 10
FORALL (I=1:10) !! Wrong dynamic type assigned to T(I)%Ptr.
T(I)%Ptr => Tar1
END FORALL
!end do
DO I = 1, 10
SELECT TYPE (aa => T(I)%Ptr)
TYPE IS (DT1)
print*, "in type is"
CLASS DEFAULT
print*, "in class default"
END SELECT
END DO
END
Flang outputs
> a.out
in class default
in class default
in class default
in class default
in class default
in class default
in class default
in class default
in class default
in class default
The expected output is
> a.out
in type is
in type is
in type is
in type is
in type is
in type is
in type is
in type is
in type is
in type is
If I replace FORALL
with the DO
loop, Flang executes successfully.