diff options
author | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-07-13 18:52:40 +0000 |
---|---|---|
committer | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-07-13 18:52:40 +0000 |
commit | d9d3bbe0ef87463576693590fbd7a4e6cc42001f (patch) | |
tree | bc801f93b4283b6097165735dcb78f48158ad430 /libgfortran | |
parent | 68e095d1fc690fe5dc8ef1c3116a1fbac4833516 (diff) | |
download | gcc-d9d3bbe0ef87463576693590fbd7a4e6cc42001f.tar.gz |
PR 49296 List read, EOF before separator, backport from trunk
2011-07-13 Janne Blomqvist <jb@gcc.gnu.org>
PR libfortran/49296
* io/list_read.c (read_logical): Don't error out if a valid value
is followed by EOF instead of a normal separator.
(read_integer): Likewise.
testsuite:
2011-07-13 Janne Blomqvist <jb@gcc.gnu.org>
PR libfortran/49296
* gfortran.dg/read_list_eof_1.f90: Add tests for integer, real,
and logical reads.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@176246 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 8 | ||||
-rw-r--r-- | libgfortran/io/list_read.c | 16 |
2 files changed, 16 insertions, 8 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 85b02a5f80b..4b865ad17aa 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,11 @@ +2011-07-13 Janne Blomqvist <jb@gcc.gnu.org> + + Backport from trunk: + PR libfortran/49296 + * io/list_read.c (read_logical): Don't error out if a valid value + is followed by EOF instead of a normal separator. + (read_integer): Likewise. + 2011-07-06 Thomas Koenig <tkoenig@gcc.gnu.org> Partial backport from trunk: diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index ce406052998..9d92f771c38 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 +/* Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Andy Vaught Namelist input contributed by Paul Thomas @@ -659,22 +659,20 @@ read_logical (st_parameter_dt *dtp, int length) { case 't': v = 1; - if ((c = next_char (dtp)) == EOF) - goto bad_logical; + c = next_char (dtp); l_push_char (dtp, c); - if (!is_separator(c)) + if (!is_separator(c) && c != EOF) goto possible_name; unget_char (dtp, c); break; case 'f': v = 0; - if ((c = next_char (dtp)) == EOF) - goto bad_logical; + c = next_char (dtp); l_push_char (dtp, c); - if (!is_separator(c)) + if (!is_separator(c) && c != EOF) goto possible_name; unget_char (dtp, c); @@ -839,6 +837,7 @@ read_integer (st_parameter_dt *dtp, int length) goto repeat; CASE_SEPARATORS: /* Not a repeat count. */ + case EOF: goto done; default: @@ -887,7 +886,7 @@ read_integer (st_parameter_dt *dtp, int length) push_char (dtp, c); break; - CASE_SEPARATORS: + CASE_SEPARATORS: goto done; default: @@ -1595,6 +1594,7 @@ read_real (st_parameter_dt *dtp, void * dest, int length) break; CASE_SEPARATORS: + case EOF: goto done; default: |