aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io
diff options
context:
space:
mode:
authorJanne Blomqvist <jb@gcc.gnu.org>2011-06-18 10:53:09 +0300
committerJanne Blomqvist <jb@gcc.gnu.org>2011-06-18 10:53:09 +0300
commitd3ff9ee4686ea27a0df76224c790c67284889f57 (patch)
tree46d30eee1cd090769d6139829ec4dc3264ec1a2f /libgfortran/io
parentc96b410243a383fb39a9c92f0632df9e60bb75c4 (diff)
downloadgcc-d3ff9ee4686ea27a0df76224c790c67284889f57.zip
gcc-d3ff9ee4686ea27a0df76224c790c67284889f57.tar.gz
gcc-d3ff9ee4686ea27a0df76224c790c67284889f57.tar.bz2
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. From-SVN: r175166
Diffstat (limited to 'libgfortran/io')
-rw-r--r--libgfortran/io/list_read.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index 38a92e1..baf2f54 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);
}