https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78881

--- Comment #7 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
This is interesting.

If I use:

read( unit=s, fmt='(DT)', iostat=istat, iomsg=imsg ) foo

then we do not lose the first character. However, the loop in the dtio
procedure does not exit.

So I inserted in the loop: if (i.gt.10) exit loop_read

resulting in:

$ ./a.out 
loop i:  1
i = 1, c = H
loop i:  2
i = 2, c = e
loop i:  3
i = 3, c = l
loop i:  4
i = 4, c = l
loop i:  5
i = 5, c = o
loop i:  6
i = 6, c =  
loop i:  7
i = 7, c =  
loop i:  8
i = 8, c =  
loop i:  9
i = 9, c =  
loop i: 10
i = 10, c =  
loop i: 11
i = 11, c =  

(I am printing the loop variable before the read)

Regardless in this case we are not losing the first character. I am speculating
that the parent procedure is starting the read based on the format specifier
and eating the first character.  As I said, this is interesting.

Reply via email to