Description
@jeanPerier #118070 has one more regression.
Source program:
program main
implicit none
type ty1
integer :: cmp
end type ty1
integer :: arr(4)
integer :: i
do i = 1, 4
arr(i) = i
end do
forall (i=1:4, bar(foo(i)) == 3)
arr(i - 2) = arr(i)
end forall
do i = 1, 4
print *, arr(i)
end do
contains
pure function foo(dmy)
implicit none
integer, intent(in)::dmy
type(ty1) :: foo(2)
foo%cmp = dmy
end function
pure function bar(dmy)
implicit none
type(ty1), intent(in):: dmy(2)
integer :: bar
bar = dmy(1)%cmp
end function
end program
Run (on AArch64):
$ flang test.f90
$ ./a.out
1
2
3
4
The statement in FORALL
shoud be executed only for i == 3
and it should output:
3
2
3
4
Curiously, this happens only with -O0
.
Tested with the latest Flang/LLVM main
branch (commit 8d550aa).
This is detected by Fujitsu Compiler Test Suite run on Linaro CI. The soruce program above is a simplified version of Fujitsu/Fortran/0608/Fujitsu-Fortran-0608_0218.test.