diff options
author | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-06-18 07:53:09 +0000 |
---|---|---|
committer | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-06-18 07:53:09 +0000 |
commit | 6e5d2d21c82843720cb1d3f02146da2fc71dc4cf (patch) | |
tree | 46d30eee1cd090769d6139829ec4dc3264ec1a2f /libgfortran | |
parent | e16e10c862fa573fe3b83a4a009d655be74db097 (diff) | |
download | gcc-6e5d2d21c82843720cb1d3f02146da2fc71dc4cf.tar.gz |
PR 49296 List directed read of string ending in EOF.
libgfortran ChangeLog entry:
2011-06-18 Janne Blomqvist <jb@gcc.gnu.org>
PR libfortran/49296
* io/list_read.c (read_character): Accept EOF as a separator when
reading string.
testsuite ChangeLog entry:
2011-06-18 Janne Blomqvist <jb@gcc.gnu.org>
PR libfortran/48296
* gfortran.dg/read_list_eof_1.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@175166 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 6 | ||||
-rw-r--r-- | libgfortran/io/list_read.c | 18 |
2 files changed, 15 insertions, 9 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index bd95cd355c1..b0f0666a3b5 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2011-06-18 Janne Blomqvist <jb@gcc.gnu.org> + + PR libfortran/49296 + * io/list_read.c (read_character): Accept EOF as a separator when + reading string. + 2011-06-17 Daniel Carrera <dcarrera@gmail.com> * caf/single.c (_gfortran_caf_register): Store the address diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index 38a92e1ba40..baf2f54041a 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -1022,7 +1022,7 @@ read_character (st_parameter_dt *dtp, int length __attribute__ ((unused))) for (;;) { if ((c = next_char (dtp)) == EOF) - goto eof; + goto done_eof; switch (c) { case '"': @@ -1068,26 +1068,26 @@ read_character (st_parameter_dt *dtp, int length __attribute__ ((unused))) invalid. */ done: c = next_char (dtp); - eof: - if (is_separator (c) || c == '!') + done_eof: + if (is_separator (c) || c == '!' || c == EOF) { unget_char (dtp, c); eat_separator (dtp); dtp->u.p.saved_type = BT_CHARACTER; free_line (dtp); } - else + else { free_saved (dtp); - if (c == EOF) - { - hit_eof (dtp); - return; - } snprintf (message, MSGLEN, "Invalid string input in item %d", dtp->u.p.item_count); generate_error (&dtp->common, LIBERROR_READ_VALUE, message); } + return; + + eof: + free_saved (dtp); + hit_eof (dtp); } |