<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/154971>154971</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[flang] Runtime failure with DTIO when the input file has slash to terminate the read of one array component.
</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 id
real :: data(3)
complex cx
contains
procedure :: readBaseFmtd
generic :: read(formatted) => readBaseFmtd
end type
contains
subroutine readBaseFmtd (dtv, unit, iotype, v_list, iostat, iomsg)
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
read (unit, *, iostat=iostat, iomsg=iomsg) dtv%id
read (unit, *, iostat=iostat, iomsg=iomsg) dtv%data
read (unit, *, iostat=iostat, iomsg=iomsg) dtv%cx
end subroutine
end module
program dcmlChildRead012
use m
type(base) :: b1
integer :: stat
character(20) :: msg
open (1, file='dcmlChildRead012.data', decimal='coMMa')
write (1, 100) (i, (j*1.11, j=i,i+1), cmplx(2*i, i**2), i=1,1)
rewind(1)
100 format (i5, 1x, e15.8, 1x, e15.8, " /", /, " (", e15.8, " ; ", e15.8, ') ')
b1%data =-1.0
read (1, *, iostat=stat, iomsg=msg) b1
!! verify b1
print*, b1%id
print*, b1%data
print*, b1%cx
end
```
The test case is using a slash to terminate the reading of `b%data` when it has 3 elements but the input file has only 2 input value.
The expected output is
```
> a.out
1
1.110000014 2.220000029 -1.000000000
(2.000000000,1.000000000)
```
Both gfortran and XLF output the expected value.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVs1u4zYQfhr6MlhDHFm2fPBBsWugQBcFFnvoraDFscWAIg2ScpK3L0hKiewEbQ8rBLE4nJ9vZr4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