diff options
author | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2007-10-04 15:57:28 +0000 |
---|---|---|
committer | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2007-10-04 15:57:28 +0000 |
commit | 808a2225f9e47b6c4c26cefc2c7068133a42ff66 (patch) | |
tree | 359610196bbde0430e898172cb9d1b058fe4fee6 | |
parent | d17cd69f66c1c0cb10074efa10252deea1ad260e (diff) | |
download | gcc-808a2225f9e47b6c4c26cefc2c7068133a42ff66.zip gcc-808a2225f9e47b6c4c26cefc2c7068133a42ff66.tar.gz gcc-808a2225f9e47b6c4c26cefc2c7068133a42ff66.tar.bz2 |
re PR libfortran/33253 (namelist: reading back a string with apostrophe)
2007-10-04 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/33253
* io/list_read.c (read_character): Use line_buffer to scan ahead for
object name or string when no delimiter is found.
From-SVN: r129016
-rw-r--r-- | libgfortran/ChangeLog | 9 | ||||
-rw-r--r-- | libgfortran/io/list_read.c | 52 |
2 files changed, 55 insertions, 6 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index a5a6731..8e4140e 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,11 @@ +<<<<<<< .mine +2007-10-04 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libfortran/33253 + * io/list_read.c (read_character): Use line_buffer to scan ahead for + object name or string when no delimiter is found. + +======= 2007-10-04 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> PR libfortran/32021 @@ -10,6 +18,7 @@ fpu_precision, sighup, sigint, allocate_init_flag and allocate_init_value. +>>>>>>> .r129015 2007-10-02 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/33253 diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index 42c534a..88b8344 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -893,14 +893,53 @@ read_character (st_parameter_dt *dtp, int length __attribute__ ((unused))) goto get_string; default: - if (dtp->u.p.namelist_mode - && (dtp->u.p.current_unit->flags.delim == DELIM_APOSTROPHE - || dtp->u.p.current_unit->flags.delim == DELIM_QUOTE - || quote == ' ')) + if (dtp->u.p.namelist_mode) { - unget_char (dtp,c); - return; + if (dtp->u.p.current_unit->flags.delim == DELIM_APOSTROPHE + || dtp->u.p.current_unit->flags.delim == DELIM_QUOTE) + { + unget_char (dtp, c); + return; + } + + /* Check to see if we are seeing a namelist object name by using the + line buffer and looking ahead for an '=' or '('. */ + l_push_char (dtp, c); + + int i; + for(i = 0; i < 63; i++) + { + c = next_char (dtp); + if (is_separator(c)) + { + unget_char (dtp, c); + eat_separator (dtp); + c = next_char (dtp); + if (c != '=') + { + l_push_char (dtp, c); + dtp->u.p.item_count = 0; + dtp->u.p.line_buffer_enabled = 1; + goto get_string; + } + } + + l_push_char (dtp, c); + if (c == '=' || c == '(') + { + dtp->u.p.item_count = 0; + dtp->u.p.nml_read_error = 1; + dtp->u.p.line_buffer_enabled = 1; + return; + } + } + + /* The string is too long to be a valid object name so assume that it + is a string to be read in as a value. */ + dtp->u.p.line_buffer_enabled = 1; + goto get_string; } + push_char (dtp, c); goto get_string; } @@ -1007,6 +1046,7 @@ read_character (st_parameter_dt *dtp, int length __attribute__ ((unused))) unget_char (dtp, c); eat_separator (dtp); dtp->u.p.saved_type = BT_CHARACTER; + free_line (dtp); } else { |