Issue |
120190
|
Summary |
[Flang] Incorrect result of FORALL when nested functions are used for the mask
|
Labels |
regression,
flang
|
Assignees |
jeanPerier
|
Reporter |
kawashima-fj
|
@jeanPerier #118070 has one more regression.
Source program:
```fortran
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):
```console
$ flang test.f90
$ ./a.out
1
2
3
4
```
The statement in `FORALL` shoud be executed only for `i == 3` and it should output:
```console
3
2
3
4
```
Curiously, this happens only with `-O0`.
Tested with the latest Flang/LLVM `main` branch (commit 8d550aa0f027eb2cf32850f3905dc1db22317587).
This is detected by [Fujitsu Compiler Test Suite run on Linaro CI](https://linaro.atlassian.net/browse/LLVM-1459). The soruce program above is a simplified version of [Fujitsu/Fortran/0608/Fujitsu-Fortran-0608_0218.test](https://github.com/fujitsu/compiler-test-suite/blob/main/Fortran/0608/0608_0218.f90).
Your #119219 fixed #118922 but did not fixed this issue.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs