This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[patch, libgfortran] PR36657 Namelist string constant immediately followed by comment
- From: Jerry DeLisle <jvdelisle at verizon dot net>
- To: Fortran List <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 28 Jun 2008 14:42:57 -0700
- Subject: [patch, libgfortran] PR36657 Namelist string constant immediately followed by comment
I plan to commit the attached patch under obvious and simple rule.
This takes care of the test case in the PR as well as following the namelist
name immediately with a comment. Strictly speaking, the namelist name is
required to have a space following it. We provide more flexibility here.
Regression tested on x86-64 and will apply the OP test case to the test suite.
Regards,
Jerry
2008-06-28 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/36657
* io/list_read.c (read_character): Check for '!' along with separators.
(find_nml_name): Likewise and eat the comment if found.
Index: list_read.c
===================================================================
--- list_read.c (revision 136998)
+++ list_read.c (working copy)
@@ -1083,7 +1083,7 @@ read_character (st_parameter_dt *dtp, in
invalid. */
done:
c = next_char (dtp);
- if (is_separator (c))
+ if (is_separator (c) || c == '!')
{
unget_char (dtp, c);
eat_separator (dtp);
@@ -2916,13 +2916,14 @@ find_nml_name:
/* A trailing space is required, we give a little lattitude here, 10.9.1. */
c = next_char (dtp);
- if (!is_separator(c))
+ if (!is_separator(c) && c != '!')
{
unget_char (dtp, c);
goto find_nml_name;
}
- eat_separator (dtp);
+ if (c == '!')
+ eat_line (dtp);
/* Ready to read namelist objects. If there is an error in input
from stdin, output the error message and continue. */