This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gfortran] Fix record terminators


When encountering a record terminator during list directed input we weren't 
setting at_eor. This meant we ended up advancing to the end of the record 
twice, skipping the next line of input..

Tested on i686-linux.
Applied to mainline.

Paul

2004-08-31  Paul Brook  <paul@codesourcery.com>

 * list_read.c (eat_separator): Set at_eo when a '/' is seen.
testsuite/
 * gfortran.dg/list_read_1.f90: New file.

Index: list_read.c
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/libgfortran/io/list_read.c,v
retrieving revision 1.6
diff -u -p -r1.6 list_read.c
--- list_read.c 23 Aug 2004 14:28:31 -0000 1.6
+++ list_read.c 31 Aug 2004 12:00:13 -0000
@@ -210,6 +210,7 @@ eat_separator (void)
     case '/':
       input_complete = 1;
       next_record (0);
+      at_eol = 1;
       break;
 
     case '\n':

! { dg-do run }
! Program to test terminators in list-directed input
program list_read_1
  character(len=5) :: s

  open (unit=11, status="SCRATCH")
  ! The / terminator was causing the next value to be skipped.
  write (11, '(a)') " 42 /"
  write (11, '(a)') " 43"
  write (11, '(a)') " 44"

  rewind(11)

  read (11, *) i
  if (i .ne. 42) call abort
  read (11, *) i
  if (i .ne. 43) call abort
  read (11, *) i
  if (i .ne. 44) call abort
  close (11)
end


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]