<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/63259>63259</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Flang] Incorrect execution result of changing the value of a reference-only dummy argument in a subroutine
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang:frontend
      </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(e6c401b5e84619c542b3db0d977fe622e872cfa1)
```

The variable i is used for the two actual arguments(`i*1` and `i`), and when the dummy argument i is redefined in the subroutine, the dummy argument j appears to be affected by the value of i.

The following are the test program, results of Flang-new, Gfortran and ifort compilation and execution.


snggl344_4.f90:
```fortran
program main
 i=1
  call sub(i*1,i)
  write(6,*) "main   : i = ", i
  if (i/=101)print *,'error-3'
  rewind 1
end program main

subroutine sub(j,i)
  write(6,*) "before : j = ", j, " i = ", i
  i = 100
 write(6,*) "after  : j = ", j, " i = ", i
  i=j+i
  if(j/=1)print *,'error-1'
end subroutine sub
```

```
$ flang-new -flang-experimental-exec snggl344_4.f90; ./a.out
 before : j =  1  i = 1
 after  : j =  100  i =  100
 error-1
 main   : i =  200
 error-3
$
```

```
$ gfortran snggl344_4.f90; ./a.out
 before : j =            1  i =            1
 after  : j =            1  i =          100
 main   : i =          101
$
```

```
$ ifort snggl344_4.f90; ./a.out
 before : j =            1  i = 1
 after  : j =            1  i =          100
 main   : i = 101
$
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVc2u6yYQfhq8GcUC_L_wIudEqbqvuq2wPThEBCLAJ_e8fYXt5OQmTdt7daMIw2j-vo8ZRnivRoPYkuKNFLtETOFgXWsPxm7kMens8NmSkq5_uiN0-yc6r6wBK0FqYcaNwQuQbAusSmlKCa-x7HPKugLrvGRNX-S8y4aODk1VSS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