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

    <tr>
        <th>Summary</th>
        <td>
            [flang] DTIO SIGABRT when the input item is namelist.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            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:
```
module m
   type base
      integer :: i = 999
 end type

   type, extends(base) :: child
      integer :: i1 = 999
 end type

   type(child) :: b1(2,2)
   type(child) :: b2(3,3)

end module

module m1
   use m
   interface read(formatted)
      subroutine readformatted(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(:)
         integer,  intent(out) :: iostat
         character(*),  intent(inout) :: iomsg
      end subroutine
   end interface
end module

program array101a
   use m1

 integer :: stat = 0
   character(200) :: msg = ''
   namelist /nml1/ b1, b2

   open (1, file = 'array101a.1', form='formatted', access='stream' )

   read (1,NML=nml1, iostat=stat, iomsg=msg)

end program


subroutine readformatted (dtv, unit, iotype, v_list, iostat, iomsg)
   use m, only: base, child

   class(base), intent(inout) :: dtv
 integer, intent(in) :: unit
   character(*), intent(in) :: iotype
 integer, intent(in)     :: v_list(:)
   integer, intent(out) :: iostat
 character(*), intent(inout) :: iomsg

end subroutine

```

`array101a.1` has
```
&NML1
 B1(1,1)= 101 102 , B1(2,1:2)= 103 104 105 106 , B2(3:1:-1,1)= 205 206 203 204 201 202 ,
 B2(1:2,2)= 207 208 209 210,
 /
 &NML2
 B3(2,2)= 999 , B3(1:2,1:2)= 301 302 303 304 ,
 /
 &NML3
 B4= 401 402 403 404 /
 /                !<- not enough data supplied
 B5(3:1:-2,1)= 501 502 503 504 ,
 B5(3:1:-2,2)= 506 507 508 509
 /
```

Flang failed at:
```
> a.out

fatal Fortran runtime error(t.f:39): DescriptorIO: bad type code (0) in descriptor
IOT/Abort trap(coredump)
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy8Vl9v46gX_TTk5aoRXOLEfsiDm_z8U6X5I-3O-wrHOGFlgwW4s_32K8Bx3LSd2dmHjaK6JuceDpdzLwjn1FlLuSfZI8mOKzH6i7H7o9BKdofDRepVbZqX_cFopxppwV8ktKbrzHelz3AyjSS8JLQkWzp9admbZuwk9ISWAOBfBgm1cDK9AoDSXp6lhRDJS1BA-BGKoggAqZsYESjncIIHkH95qRtHMI9cWFzDTxfVNR9ys39AnieKG2XNCOZI8IAEix8jkWDOCR54QhJahklSBtL7NRssEY1uzkzQaltxkmClaAjmrbG98F4287QA4MbamtErnWALTN7455CaUSsfnspck_X8R6fcNOa8mP7r3RmWzEFCPxjrX28PAJw64RapjuHaS-0J5kqb0S9SEEQsGdMG3IUs8FHtcq6LsOLkQ0hOsHw73SJ2WiEtfzBN-Ezwaxry8H638Fv8jeD1wqbU_VTqx6mJKZ8JgjFum5mGw9hsg3fMM1hztqIHYa14YZSJhYnYZOM7ywfR0fQ0YZeikdKFvOgHfgSCu_CNaC16GZIGBCvdd4xgFcvhEKx-LRszSA0E8zjeqk5eaWaZaxZJDxDsSviR4G5h3PiLOJ2kc-k3560UPcEdzGUEEO1-nebL50-EH5Oi2dX8-MrchB_D32UhTvlLA4SWHxUT_Ktqmj2VihoPYHT3EvtCLJzD3Jymrfj1svqFcvqvC-m9yI8q6Kfa3i-caRdfVc3dYZNel8bbUrgIdw_D7ZfPn2IPfmSTp1iQwY_AKANGEYKkx2vrZ4SXOAM4MLoBRjNgdJuAqfPzMgAflnRIM0C6BaQckG4AKQNM9HF6jNNH9gPOMTtAmgPSApDRCUqwSo-gHWMwX55M6WRLcviCdamdUwacInDKgdMNvEfNI_UmwDeUwYYibCiHTYRPuAruPgQZ4YcH0MaD1GY8X6ARXoAbh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