This is the mail archive of the
mailing list for the GCC project.
Re: [gfortran] Fix list directed reads of real number
On Fri, Dec 10, 2004 at 11:13:43PM +0100, Steven Bosscher wrote:
> On Friday 10 December 2004 22:52, Steve Kargl wrote:
> > On Fri, Dec 10, 2004 at 11:27:27AM -0800, Steve Kargl wrote:
> > Crud! The patch doesn't totally fix the problem.
> > troutmask:sgk gfc -o fg fg.f90
> > troutmask:sgk ./fg
> > 10,-20,30,40
> > 10.00000 0.000000 30.00000 40.00000
> > troutmask:sgk cat fg.f90
> > program fg
> > character(len=80) buff
> > write (buff,'(a)') '10,-20,30,40'
> > read(buff,*) a, b, c, d
> > print *, buff
> > print*, a, b, c, d
> > end program
> > If a minus sign follows a comma, my patch appears to miss
> > the next digit.
> What happens is that when the library is asked to read the second real,
> it is still looking at the comma. I would expect it to gobble that as
> part of reading the first real.
That's what I thought. The relevant code fragment is
unget_char (c); /* Single null. */
where I changed a "return" to the above "break". I thought the
eat_separator() invocation would gobble up the comma. What I
don't understand, is what does the unget_char(c) function do?