]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR fortran/69668 (Error reading namelist opened with DELIM='NONE')
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Thu, 18 Feb 2016 18:23:09 +0000 (18:23 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Thu, 18 Feb 2016 18:23:09 +0000 (18:23 +0000)
2016-02-18  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

Backport from gcc-5-branch.
PR libgfortran/69668
* io/list_read.c (read_character): Remove code related to DELIM_NONE.
* gfortran.dg/namelist_38.f90: Update test.
* gfortran.dg/namelist_84.f90: Update test.

From-SVN: r233528

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/namelist_38.f90
gcc/testsuite/gfortran.dg/namelist_84.f90
libgfortran/ChangeLog
libgfortran/io/list_read.c

index 4d9f8f118deba4fd2b030541bfd863164791230f..b0b902fe1838adffdda148393cba4c07867685d3 100644 (file)
@@ -1,3 +1,10 @@
+2016-02-18  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       Backport from gcc-5-branch.
+       PR libgfortran/69668
+       * gfortran.dg/namelist_38.f90: Update test.
+       * gfortran.dg/namelist_84.f90: Update test.
+
 2016-02-18  Marek Polacek  <polacek@redhat.com>
 
        2016-02-12  Marek Polacek  <polacek@redhat.com>
index 5578654eea48d8cc978a22cfc74b6cdfb3e6ae51..b51463cfa8a3d3fcce11822aa16e362a6b447c51 100644 (file)
@@ -5,6 +5,7 @@
 program main
   implicit none
   character(len=3) :: a
+  character(25) :: b
   namelist /foo/ a
 
   open(10, status="scratch", delim="quote")
@@ -28,9 +29,12 @@ program main
   open(10, status="scratch", delim="none")
   a = "a'a"
   write(10,foo) 
-  rewind 10
-  a = ""
-  read (10,foo)
-  if (a.ne."a'a") call abort
-  close (10)
+  rewind (10)
+  read(10,"(a)") b
+  if (b .ne. "&FOO") call abort
+  read(10,"(a)") b
+  if (b .ne. " A=a'a") call abort
+  read(10,"(a)") b
+  if (b .ne. " /") call abort
+  close(10)
 end program main
index af139d91edc9f99b375f9ff67d066ea28d5a9c01..14b68a44e8a340d1ebc39d38ee6e71b95684d640 100644 (file)
@@ -17,12 +17,11 @@ program namelist_delim_none
    write(10, mylist)
    rewind(10)
    mystring = "xxxxx"
-   read(10,mylist)
-   if (any(mystring /= (/ 'mon', 'tue', 'wed', 'thu', 'fri' /))) call abort
    rewind(10)
    do i=1,5
      read(10,'(a)') internal_unit
-     if (scan(internal_unit,"""'").ne.0) call abort
+     if (i.eq.2 .and. internal_unit .ne. " MYSTRING=mon  tue  wed  thu  fri  ,") call abort
+     if (scan(internal_unit,"""'").ne.0) print *, internal_unit
    end do
    close(10)
 end program
index 5cdd8192e15b1ebf6674e566337194da34891819..30126793489c4fd350acdb107b5a2f627393c72e 100644 (file)
@@ -1,3 +1,9 @@
+2016-02-18  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       Backport from gcc-5-branch.
+       PR libgfortran/69668
+       * io/list_read.c (read_character): Remove code related to DELIM_NONE.
+
 2015-08-28  James Greenhalgh  <james.greenhalgh@arm.com>
 
        Backport from gcc-5-branch.
index b95721069ccb20768f655631816c3a54cb5d6748..d3fac4c52a5ca917bd1e26850400c27d56583237 100644 (file)
@@ -1006,21 +1006,6 @@ read_character (st_parameter_dt *dtp, int length __attribute__ ((unused)))
     default:
       if (dtp->u.p.namelist_mode)
        {
-         if (dtp->u.p.current_unit->delim_status == DELIM_NONE)
-           {
-             /* No delimiters so finish reading the string now.  */
-             int i;
-             push_char (dtp, c);
-             for (i = dtp->u.p.ionml->string_length; i > 1; i--)
-               {
-                 if ((c = next_char (dtp)) == EOF)
-                   goto done_eof;
-                 push_char (dtp, c);
-               }
-             dtp->u.p.saved_type = BT_CHARACTER;
-             free_line (dtp);
-             return;
-           }
          unget_char (dtp, c);
          return;
        }