<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/110921>110921</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[flang][AIX] incorrect maxloc/minloc with -O
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
kkwli
</td>
</tr>
</table>
<pre>
Reproducer
```fortran
logical :: l
! logical :: l(3)
integer, dimension(3) :: a
integer :: ia(1)
a = [ 0, -1, 3 ]
l = .true.
ia = minloc(a, mask=l)
print *, ia(1)
end
```
```
$ flang-new minloc.f90 ; a.out
2
$ flang-new -O minloc.f90 ; a.out
0
```
If the mask `l` is an array, the result is correct.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8UsFupDoQ_JrmYoHsNgz4wGHmIaScIr3TXg0Y8MbYI9skm79fwTDZ0Wy0EgKpu6q7qikZgp6sUjUUFyiaRK5xdr5-e_swOunc8Fn_r67eDWuvPNAG6BlO9PaMzkcv7a1KjJt0Lw0BfgZ-JuYAIyN_t7DigOIgEm2jmpQH_I8MelE2aGcPyJ0iD-wBvZe1BKzY16j7QEmANwSKC6Hb0JRtb06gaO4IsyOy6FeVfcm40RZtjesBK7mxFhnegDfmQe7VaxsJ4HnrPylQdng60qOy5yLmZDTSTqlVH8febBSUAL8Qmbk1HivxO3z6-i8K_Xbjy0jirHZTBE7UwIkSHYi0RHovPzdDW9-rsJq4dXrnvepj9ugiGWo-CC5kompWYlkJUQmazHUvVC9OOetzVclKjBWOY4GcDrzsGOu7RNdIMWeUIlLGOM1oeeqGkmKZFzlnYoScqkVqkxnzvmTOT4kOYVU1Y1QgS4zslAl7UhH3SwDiFlpfb4S0W6cAOTU6xPBnRNTR7PG-MYoGisv55QcUDdH2MEgW-Wv_6-3tpuRDx5mkr8nqTT3HeA1b4rAFbCcd57XLercAttuS45Nevfup-gjY7qIDYHvofq_xdwAAAP__PfTzDw">