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

    <tr>
        <th>Summary</th>
        <td>
            [Flang] Incorrect output of intrinsic `INQUIRE`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            bug,
            flang:runtime
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          DanielCChen
      </td>
    </tr>
</table>

<pre>
    Consider the following code:
```
     character(:), allocatable :: r_mode
 allocate (character*18 :: r_mode)

     r_mode=repeat(' ', 18)
 open(15, file='file6', round="PROCESSOR_DEFINED")
     inquire(15, round=r_mode(14:))
     print*, r_mode
     if(r_mode .ne. ' PROCE') error stop 6

  end
```

Flang outputs
```
 NEARE
Fortran ERROR STOP: code 6
```

Expected output is successful execution (XLF, gfortran and ifort).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsU11v4ygU_TX4BTXC4M8HP2QTW4q0arrprrRvFcbXNiMCHj46nX8_wnHazqgois3lnnPgHMOdk5MGaFD-F8qPCQ9-NrY5ci1BHQ4z6KQ3w8_mYLSTA1jsZ8CjUcr8kHrCwgyA2B6RIyJ7VJDtt05xHGLmlgsPFtEqNtIa0QPmShnBPe8V4Fhle2xfrpHrhtzWASNafWLYp9Uf7bTepD8UtxV2tLAA91GXlhjRMgqn1TsEmwU0olWax4VRqohBtIxvxdZuTdDDWqZPl_OhfX4-X16ObXd6bGPtgysOqb8HaeGd8g6-b7VKs7sDn2GLldojul8hn01YOUdEq1sV7zTs4jnwupV1hzUGa43FzpsFF79bAXr4Mpbbf6e4nrAJfgnefR3fY7u_tFu3sd5yjdvL5XzBz_-en2IGMfx31a9E2rcFhIdh08HSYReEAOfGoDC8gQheGh1T_v_vLhowjZsS1wOWcYJovUuGhg01q3kCTVqmZU4ZZVkyNwURY52XlJA8zUVapX3Nikpk0OeMsV4ksqGEZqQgWVpmZcp2ArJ-qMoSRCrIADXKCFy5VDulXq87Y6dEOhegqTNWZYniPSi33g1K-zCtmR8QpWO0D7G9DdrLK8R6fkxsE1ke-jA5lBElnXcfvF56tV6z1XqUH_FJC2MtCH_3x4xYam-ldlJgVJDT4z__nS4tKkgSrGpm7xe3fkIdot0k_Rz6nTBXRLuosj0eFmu-gfCIdutRHKLd7TSvDf0VAAD__8auIu8">