aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2007-12-17 00:47:14 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2007-12-17 00:47:14 +0000
commit78a15b1f3f64783796b3f1ddbac94041fe1d4f29 (patch)
tree408cb4fc5dc4082b93a6241a8cfa132f36e1c11f /libgfortran/io
parent3bee5325cad87db543b803f3ca64cd50c9453598 (diff)
downloadgcc-78a15b1f3f64783796b3f1ddbac94041fe1d4f29.zip
gcc-78a15b1f3f64783796b3f1ddbac94041fe1d4f29.tar.gz
gcc-78a15b1f3f64783796b3f1ddbac94041fe1d4f29.tar.bz2
re PR libfortran/34427 (Revision 130708 breaks namelist input)
2007-12-16 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/34427 * io/list_read.c (read_real): Handle intervening line ends and spaces. (get_name): Don't push separators to saved_string. (eat_separator): If in namelist mode eat spaces and line ends as well. From-SVN: r131003
Diffstat (limited to 'libgfortran/io')
-rw-r--r--libgfortran/io/list_read.c54
1 files changed, 34 insertions, 20 deletions
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index e63fca5..df43589 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -307,15 +307,31 @@ eat_separator (st_parameter_dt *dtp)
break;
case '\r':
+ dtp->u.p.at_eol = 1;
n = next_char(dtp);
if (n == '\n')
- dtp->u.p.at_eol = 1;
+ {
+ if (dtp->u.p.namelist_mode)
+ {
+ do
+ c = next_char (dtp);
+ while (c == '\n' || c == '\r' || c == ' ');
+ unget_char (dtp, c);
+ }
+ }
else
unget_char (dtp, n);
break;
case '\n':
dtp->u.p.at_eol = 1;
+ if (dtp->u.p.namelist_mode)
+ {
+ do
+ c = next_char (dtp);
+ while (c == '\n' || c == '\r' || c == ' ');
+ unget_char (dtp, c);
+ }
break;
case '!':
@@ -1141,12 +1157,7 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length)
exp2:
if (!isdigit (c))
- {
- if (c == 'i' || c == 'I' || c == 'n' || c == 'N')
- goto inf_nan;
- else
- goto bad;
- }
+ goto bad;
push_char (dtp, c);
@@ -1315,7 +1326,7 @@ read_real (st_parameter_dt *dtp, int length)
{
char c, message[100];
int seen_dp;
- int is_inf, i;
+ int is_inf;
seen_dp = 0;
@@ -1578,20 +1589,22 @@ read_real (st_parameter_dt *dtp, int length)
l_push_char (dtp, c);
}
- if (!is_separator (c) || c == '=')
+ if (!is_separator (c))
goto unwind;
- if (dtp->u.p.namelist_mode && c != ',' && c != '/')
- for (i = 0; i < 63; i++)
- {
- eat_spaces (dtp);
- c = next_char (dtp);
- l_push_char (dtp, c);
- if (c == '=')
- goto unwind;
+ if (dtp->u.p.namelist_mode)
+ {
+ if (c == ' ' || c =='\n' || c == '\r')
+ {
+ do
+ c = next_char (dtp);
+ while (c == ' ' || c =='\n' || c == '\r');
- if (c == ',' || c == '/' || !is_separator(c))
- break;
+ l_push_char (dtp, c);
+
+ if (c == '=')
+ goto unwind;
+ }
}
if (is_inf)
@@ -2594,7 +2607,8 @@ get_name:
do
{
- push_char (dtp, tolower(c));
+ if (!is_separator (c))
+ push_char (dtp, tolower(c));
c = next_char (dtp);
} while (!( c=='=' || c==' ' || c=='\t' || c =='(' || c =='%' ));