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

    <tr>
        <th>Summary</th>
        <td>
            [Flang] Incorrect execution result of a position-edit-desc in WRITE statement
        </td>
    </tr>

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

The execution result of using a position-edit-desc(T n) in `WRITE` statement is incorrect.

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


snggj807_2.f90:
```fortran
program main
 character(len=12)::c
  write(1,'("abc",T10)',advance='no')
 write(1,'("def")')
  rewind 1
  read(1,'(a)')c
  write(6,*) "c = ", c
  if (c/='abc      def')write(6,*) "NG"
  print *,'pass'
end program main
```

```
$ flang-new -flang-experimental-exec snggj807_2.f90; ./a.out
 c = abc
 NG
 pass
$
```

```
$ gfortran snggj807_2.f90; ./a.out
 c = abc def
 pass
$
```

```
$ ifort snggj807_2.f90; ./a.out
 c = abc      def
 pass
$
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVMFu4zYQ_ZrRhbBADSWZOujgjevFXvZQBO2xoKiRzEAmDZLebP--IC0njdeHBg0CWRwO33vDGT0VgpktUQ_NF2j2hbrEo_O9O1q3mV6KwY1_99Dy9Z_vge_-IB-Ms8xNbFqUnTeWXhmIHau2JS85oJxaXUsux65BrFQjhaSqrrf12DW6nUg2w1DVUirA7gp5x3B9Ph-J0U_Sl5jYPIXLEhPpJRg7M8XOLpi0taHRxM1IQQPKZ2YBO2Ysg5b_-fu359-g5SxEFelENjITmLHaeU86lvdsk1sW95rRPbF4JBYpRHb2bvbqBPi0qghJxuFWe4p_nZyPXlmm7MhMWjDtTmezqCw-Rd9K-UB7fQY7zy-Sb__Ccuo4iN3dtazo1-gqh52UWSNMH5VXOpIHlAtZEPsK0-WKHYidXpPYqzeRAGUF-AS4BZSAqAYNiIBPzxVPR1L8SY0_lNUEYg-4tS4H11Y9Rhlpyijdh1Tm6dXYkVXvazV-OKrejvyiss1Ju9RNQNQMxJ5dlbK3XDMxQKkBD1epatAs_2U9CfYx2vevCWkFOXtjI8ubSdVZhZDO5l2yI_v1vh-O630Q6399HpvrK_08kzdpENWySQPB7jv_hZWAB1W6S7z1Nlee2nRdf_-6vmShN67PCZtv4_oJ-nyn_5v5-m18hvatn_-Vuxh7MXaiUwX1VSubTnRdUxfHvmq5rFvZkh6EGOpKDx1v-djwZhrEKERheuQoeMsbXouuqksaWuR8W8mWsBFTAzWnkzJLuSw_TqXzc2FCuFDfiqqqikUNtITspIi54WnKmn3h-5S_GS5zgJovJsTwjhBNXLL9ZkOBZs--3Qzqof09Mr7kd9ns3p2uuPilP8Z4DskF8AB4mE08XoZSuxPgIfGvP5uzdy-kI-AhlxMAD7mifwIAAP__npSz2w">