[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-fortran
Subject:    [patch,libgfortran] PR25419 gfortran read does not take comma for  default
From:       Jerry DeLisle <jvdelisle () verizon ! net>
Date:       2005-12-26 7:08:47
Message-ID: 43AF96FF.4080309 () verizon ! net
[Download RAW message or body]

:ADDPATCH fortran:

The below patch is "simple and obvious" (obvious being a relative term) I will 
commit along with attached test case in ~24 hours unless I am notified 
otherwise.  Behavior with this patch matches g77 and ifort.

NOTE:  The patch may have an offset since I have another patch pending in 
list_read.c

Regards,

Jerry

Regression tested and NIST tested on i686-pc-linux-gnu.

2005-12-26  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/25419
	* io/list_read.c (list_formatted_read_scalar): Allow comma to return a
	null value (default).

Index: io/list_read.c
===================================================================
*** io/list_read.c      (revision 109050)
--- io/list_read.c      (working copy)
*************** list_formatted_read_scalar (st_parameter
*** 1353,1362 ****
         {                       /* Found a null value.  */
           eat_separator (dtp);
           dtp->u.p.repeat_count = 0;
!         if (dtp->u.p.at_eol)
!           finish_separator (dtp);
!           else
!           goto cleanup;
         }

       }
--- 1353,1359 ----
         {                       /* Found a null value.  */
           eat_separator (dtp);
           dtp->u.p.repeat_count = 0;
!         goto cleanup;
         }

       }

["comma.f" (text/x-fortran)]

! { dg-do run }
! PR25419 Default input with commas.
! Derived from example given in PR.
! Contributed by Jerry DeLisle  <jvdelisle@gcc.gnu.org> 
      stuff = 1
      stuff2 = 2
      write(11,'(a)') ",,"
      rewind(11)
      read(11,*)stuff, stuff2
      if (stuff.ne.1.0) call abort()
      if (stuff2.ne.2.0) call abort()
      rewind (11)
      write(11,'(a)') ","
      rewind(11)
      read(11,*)stuff
      if (stuff.ne.1.0) call abort()
      end



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic