<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/102861>102861</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Differences in behavior from other compilers for lfortran test case (any intrinsic)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
k-arrows
</td>
</tr>
</table>
<pre>
The following `any_01.f90` comes from integration_tests of lfortran.
https://github.com/lfortran/lfortran/blob/main/integration_tests/any_01.f90
```f90
program any_01
logical :: c1(2), c2(3)
integer :: a(2, 3), b(2, 3)
! TODO: Deal with passing array constants to intrinsics
! logical :: l
! l = any((/.true., .true., .true./))
! print *, l
a = 1
b = 1
b(2, 2) = 2
call section(a, b, 1, c1)
print *, c1
call section(a, b, 2, c2)
print *, c2
contains
subroutine section(a, b, axis, c)
integer, intent(in) :: a(2, 3), b(2, 3), axis
logical, intent(out) :: c(:)
c = any(a == b, axis)
end subroutine section
end program any_01
```
Gfortran and intel compilers can compile and execute this program.
https://godbolt.org/z/osTch9ET5
```console
$ gfortran any_01.f90
$ ./a.out
T T
T T F
```
With flang-new, I got the following.
```console
$ flang-new any_01.f90
$ ./a.out
fatal Fortran runtime error(/tmp/any_01.f90:23): Assign: mismatching element counts in array assignment (to 2, from 3)
Aborted
$ flang-new -flang-deprecated-no-hlfir any_01.f90
$ ./a.out
T T
T T F
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVUuPqzYU_jXO5igITB6wYJFOStXV3UTq8sqYA7g1dmSbmTv99dUxeZDMtJ3FlVDix_F3vvMW3qveIFZs-wvbHldiCoN11V9r4Zx986vGtu_VaUDorNb2TZke2C4V5v17miVdmbJdCtKO6KFzdgRlAvZOBGXN94A-eLAd6M664IRJWHpk6WEI4exZfmC8ZrzuVRimJpF2ZLy-Sj4uG20bxutRKNp9UMF4veATVbBdOn-3k7Ozv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