<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62597>62597</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[flang] Incorrect execution result of MVBITS intrinsic subroutine
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ohno-fj
</td>
</tr>
</table>
<pre>
```
Version of flang-new : 17.0.0(5a50ba03e9adb1614189530f8a5ef06d90dfd670)
```
The execution result of `MVBITS` intrinsic subroutine is incorrect.
The first argument of the `MVBITS` intrinsic subroutine is an array.
The following are the test program, results of flang-new, gfortran and ifort compilation and execution.
snggf586_2.f90:
```fortran
program main
integer i(2),j(2)
i=(/1,1/);j=(/2,1/)
write(6,*) "i = ", i, " j = ", j, " i(j) = ", i(j)
call mvbits(i(j),0,2,i,1)
write(6,*) "i = ", i
if (any(i/=3))write(6,*) "NG"
end program main
```
```
$ flang-new -flang-experimental-exec snggf586_2.f90; ./a.out
i = 1 1 j = 2 1 i(j) = 1 1
i = 3 7
NG
$
```
```
$ gfortran snggf586_2.f90; ./a.out
i = 1 1 j = 2 1 i(j) = 1 1
i = 3 3
$
```
```
$ ifort snggf586_2.f90; ./a.out
i = 1 1 j = 2 1 i(j) = 1
1
i = 3 3
$
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVU2PozgQ_TXFpRRkyoHAgUN3oozmsHPZ0VxXBgxxROzINtPT_35lIB9kop3uRS3aeUW9eq8oG-Gc6rSUJaSvkO4iMfiDsaU5aLNqj1FlmvcSMjb_sR2wlx_SOmU0mhbbXuhupeUbAn_BZBOzmAHlqUhZJRiXhWiqJEvWSV6knLW5SGXLsqZgTdtkGwZUTJQPFab794NE-UvWgw_VrHRD70NRyNhfP16_fv8bMoZKe6u0UzW6obJm8EpLVA6Vro21svbxjaxV1nkUthtOUo9U_iA_Ric0CmvFe_w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