diff options
author | Tobias Burnus <burnus@net-b.de> | 2007-12-20 09:16:48 +0100 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2007-12-20 09:16:48 +0100 |
commit | 667e20459d82a01e61fc590781c53fd2c136ef96 (patch) | |
tree | eab804f70961f5d88c426a50b8e0c132732f0dd4 /libgfortran | |
parent | c7abc45c7f097a501a93d0778cfa445745b74d22 (diff) | |
download | gcc-667e20459d82a01e61fc590781c53fd2c136ef96.zip gcc-667e20459d82a01e61fc590781c53fd2c136ef96.tar.gz gcc-667e20459d82a01e61fc590781c53fd2c136ef96.tar.bz2 |
re PR libfortran/34530 (namelist read broken when whitespace after &namelist)
2007-12-20 Tobias Burnus <burnus@net-b.de>
PR fortran/34530
* io/list_read.c (eat_line): Move up in the file.
(eat_separator): In namelist mode, skip over comment lines.
2007-12-20 Tobias Burnus <burnus@net-b.de>
PR fortran/34530
* gfortran.dg/namelist_44.f90: New.
From-SVN: r131099
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 6 | ||||
-rw-r--r-- | libgfortran/io/list_read.c | 37 |
2 files changed, 28 insertions, 15 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 286524b..9d84e1b 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2007-12-19 Tobias Burnus <burnus@net-b.de> + + PR fortran/34530 + * io/list_read.c (eat_line): Move up in the file. + (eat_separator): In namelist mode, skip over comment lines. + 2007-12-16 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/34427 diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index df43589..06fd8a1 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -275,6 +275,20 @@ eat_spaces (st_parameter_dt *dtp) } +/* This function reads characters through to the end of the current line and + just ignores them. */ + +static void +eat_line (st_parameter_dt *dtp) +{ + char c; + if (!is_internal_unit (dtp)) + do + c = next_char (dtp); + while (c != '\n'); +} + + /* Skip over a separator. Technically, we don't always eat the whole separator. This is because if we've processed the last input item, then a separator is unnecessary. Plus the fact that operating @@ -328,7 +342,14 @@ eat_separator (st_parameter_dt *dtp) if (dtp->u.p.namelist_mode) { do - c = next_char (dtp); + { + c = next_char (dtp); + if (c == '!') + { + eat_line (dtp); + c = next_char (dtp); + } + } while (c == '\n' || c == '\r' || c == ' '); unget_char (dtp, c); } @@ -407,20 +428,6 @@ finish_separator (st_parameter_dt *dtp) } -/* This function reads characters through to the end of the current line and - just ignores them. */ - -static void -eat_line (st_parameter_dt *dtp) -{ - char c; - if (!is_internal_unit (dtp)) - do - c = next_char (dtp); - while (c != '\n'); -} - - /* This function is needed to catch bad conversions so that namelist can attempt to see if dtp->u.p.saved_string contains a new object name rather than a bad value. */ |