]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/50109 (Formatted namelist read with multiple "!" fails with: Cannot...
authorTobias Burnus <burnus@net-b.de>
Thu, 18 Aug 2011 14:23:41 +0000 (16:23 +0200)
committerTobias Burnus <burnus@gcc.gnu.org>
Thu, 18 Aug 2011 14:23:41 +0000 (16:23 +0200)
2011-08-18  Tobias Burnus  <burnus@net-b.de>

        PR fortran/50109
        * io/list_read.c (eat_separator): Fix skipping over "!" lines.

2011-08-18  Tobias Burnus  <burnus@net-b.de>

        PR fortran/50109
        * gfortran.dg/namelist_73.f90: New.

From-SVN: r177858

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/namelist_73.f90 [new file with mode: 0644]
libgfortran/ChangeLog
libgfortran/io/list_read.c

index 0b09a0cca248501773ce1b59e217bc34c4ede63e..fa059476905e5859e26c798bcf393cabb46c476f 100644 (file)
@@ -1,3 +1,8 @@
+2011-08-18  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/50109
+       * gfortran.dg/namelist_73.f90: New.
+
 2011-08-18  Jakub Jelinek  <jakub@redhat.com>
 
        * g++.dg/plugin/decl_plugin.c: Include diagnostic.h.
diff --git a/gcc/testsuite/gfortran.dg/namelist_73.f90 b/gcc/testsuite/gfortran.dg/namelist_73.f90
new file mode 100644 (file)
index 0000000..8fc88aa
--- /dev/null
@@ -0,0 +1,28 @@
+! { dg-do run }
+!
+! PR fortran/50109
+!
+! Contributed by Jim Hanson
+!
+      program namelist_test
+
+      integer nfp
+      namelist /indata/ nfp
+
+      nfp = 99
+      open(unit=4, status='scratch')
+      write(4,'(a)') '$indata'
+      write(4,'(a)') 'NFP = 5,'
+      write(4,'(a)') "!  "
+      write(4,'(a)') "! "
+      write(4,'(a)') "!  "
+      write(4,'(a)') '/'
+
+      rewind(4)
+      read (4,nml=indata)
+      close(4)
+
+!      write(*,*) nfp
+      if (nfp /= 5) call abort()
+
+      end
index a30f264307a173716513f6eb133c822d89bbf517..f846b08f9aebfb186e1d5ef84a1d9c48a3183467 100644 (file)
@@ -1,3 +1,8 @@
+2011-08-18  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/50109
+       * io/list_read.c (eat_separator): Fix skipping over "!" lines.
+
 2011-07-23  Andreas Schwab  <schwab@linux-m68k.org>
 
        * intrinsics/ctime.c: Include <stdlib.h>.
index 01272d0cb4e37c821ac4400b15c0f047c41e9be7..11a35c941ccbace5641665f58e4957e027de4341 100644 (file)
@@ -351,16 +351,7 @@ eat_separator (st_parameter_dt *dtp)
                  err = eat_line (dtp);
                  if (err)
                    return err;
-                 if ((c = next_char (dtp)) == EOF)
-                   return LIBERROR_END;
-                 if (c == '!')
-                   {
-                     err = eat_line (dtp);
-                     if (err)
-                       return err;
-                     if ((c = next_char (dtp)) == EOF)
-                       return LIBERROR_END;
-                   }
+                 c = '\n';
                }
            }
          while (c == '\n' || c == '\r' || c == ' ' || c == '\t');