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

    <tr>
        <th>Summary</th>
        <td>
            [Flang] Incorrect diagnostic on `v_list` in defined I/O
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang:frontend
      </td>
    </tr>

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

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

<pre>
    Consider the following code
```
module m
    type base
        real(4), allocatable :: d1
    end type

    interface read(formatted)
 subroutine formattedRead (dtv, unit, iotype, v_list, iostat, iomsg)
 import base
            class (base), intent(inout) :: dtv
 integer, intent(in) :: unit
            character(*), intent(in) :: iotype
 integer, intent(in) :: v_list(2:)  !<-- this is legal
 integer, intent(out) :: iostat
            character(*), intent(inout) :: iomsg
        end subroutine
    end interface
end module

```

Flang currently issues an error as:
```
./t.f:12:36: error: Dummy argument 'v_list' of a defined input/output procedure must be deferred shape
 integer, intent(in) :: v_list(2:)  !<-- this is legal
 ^^^^^^
```

1. The code is valid.
2. The error message complains about "deferred shape" where the `v_list` is supposed to be "assumed-shape". 

All ifort, gfortran and XLF compile the code successfully.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0VN-rrDYQ_muyL8OKRl31wQe7p8KFQqH0oW8lmlFTYiL5sZf978uo95xz91JoHyqCMZn55vsmXyK8V7NBbFn5EyvfLiKGxbr2TRiF-n5f0FwGK5_t3RqvJDoIC8JktbZflZlhtBJZ2rFber5pt1oZNcLK0g4AIDw3hEF4PP_pcSg043XBeMP4HYTWdhRBDBqB5R3LO5DZGY5G7hBU5JhRJqCbxIgEIxmvJ-tWEQJKgks78HFwNgZliOi59BsKCYzXMjyoYjQq0FfZHZvf4fGnVv6c80Gco9XPJ6haN-vCqxB6Ri28J-x97VBEHE1gvFbGxsB4864rPHY0E3BG9xL6KW4n-FJnEU6MgbJqxrsfK31KP3X9m0rfhNecJngDwHjG8vv1CmFRHpQHjbPQ_wT2vb6zef-R-SsGtf0DgizwsaeffPHuBJZ29H8473DKZ0eytOu1ILdG59AE_QTlfUQPwgA6Zx0IT8W_T0sY70MysbzLqDf5jcjt4TR4i-v6BOHmuKIJwHj1rZMV2AkESJyUQWK5kbzexrDFAJuzI8roENboAwxIgegcSvCL-B82jZU_v74_tCdL4PcF99NMuQ-hlUxY2vFj_ujRit6LmaLWTQtlPIjBRpLOXyRwDl8XdLhfFuyWnnRvKYH7uG3Wo4RgST3jXHgfV5TXb8kJHKw6rUFN1u2HcaaBEwaEkfDHL_1OQ-mjxk7cx3FE76eo9TO5yDaXTd6IC7ZZlddVlVdpc1laWQs5jFlV3opilLcJsS4bLIohz26Ylc1FtTzlZcrTMrsVWdEkVVGW4pYXzZjmWJQDK1JchdKJ1o81sW6-7G5qM17WVX3RYkDt9_uU84l8x_JucpY2UjLO6ZZ1LeVehzh7VqTUHP-BFlTQ-328m5aVb_DFjNY5HANIJWZjfVAjWPPSWvNuuS-M979eotPtEsK2W5v3jPezCkscktGujPdU7_xcN2f_wpFcehwMxvtTzaPlfwcAAP__ud7fnA">