diff options
author | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-01-02 17:09:09 +0000 |
---|---|---|
committer | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-01-02 17:09:09 +0000 |
commit | c06baa01b9d5da48665ab4838cf9efef50498f2a (patch) | |
tree | 96f69140388e01cd86f90c4f421f951de7d9ebb1 /libgfortran | |
parent | 4750917489fd6d317dd6c9fdda5247dd93a92244 (diff) | |
download | gcc-c06baa01b9d5da48665ab4838cf9efef50498f2a.tar.gz |
2013-01-02 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/55818
* io/list_read.c (read_real): Do not call hit_eof when EOF can be
treated as a value separator.
(parse_real): Likewise.
(read_logical): Likewise.
(read_character): Likewise.
(read_complex): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194809 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 10 | ||||
-rw-r--r-- | libgfortran/io/list_read.c | 39 |
2 files changed, 34 insertions, 15 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index fa651f9264c..2c4dcbb7e46 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,13 @@ +2013-01-02 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libfortran/55818 + * io/list_read.c (read_real): Do not call hit_eof when EOF can be + treated as a value separator. + (parse_real): Likewise. + (read_logical): Likewise. + (read_character): Likewise. + (read_complex): Likewise. + 2012-12-27 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/48976 diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index 403e7190a12..acc27e449b1 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -1,4 +1,5 @@ /* Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012 + 2013 Free Software Foundation, Inc. Contributed by Andy Vaught Namelist input contributed by Paul Thomas @@ -697,6 +698,7 @@ read_logical (st_parameter_dt *dtp, int length) break; CASE_SEPARATORS: + case EOF: unget_char (dtp, c); eat_separator (dtp); return; /* Null value. */ @@ -951,6 +953,7 @@ read_character (st_parameter_dt *dtp, int length __attribute__ ((unused))) break; CASE_SEPARATORS: + case EOF: unget_char (dtp, c); /* NULL value. */ eat_separator (dtp); return; @@ -975,8 +978,7 @@ read_character (st_parameter_dt *dtp, int length __attribute__ ((unused))) for (;;) { - if ((c = next_char (dtp)) == EOF) - goto eof; + c = next_char (dtp); switch (c) { CASE_DIGITS: @@ -984,6 +986,7 @@ read_character (st_parameter_dt *dtp, int length __attribute__ ((unused))) break; CASE_SEPARATORS: + case EOF: unget_char (dtp, c); goto done; /* String was only digits! */ @@ -1041,7 +1044,7 @@ read_character (st_parameter_dt *dtp, int length __attribute__ ((unused))) the string. */ if ((c = next_char (dtp)) == EOF) - goto eof; + goto done_eof; if (c == quote) { push_char (dtp, quote); @@ -1167,6 +1170,7 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length) goto exp2; CASE_SEPARATORS: + case EOF: goto done; default: @@ -1202,6 +1206,7 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length) break; CASE_SEPARATORS: + case EOF: unget_char (dtp, c); goto done; @@ -1243,7 +1248,7 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length) && ((c = next_char (dtp)) == 'y' || c == 'Y') && (c = next_char (dtp)))) { - if (is_separator (c)) + if (is_separator (c) || (c == EOF)) unget_char (dtp, c); push_char (dtp, 'i'); push_char (dtp, 'n'); @@ -1255,7 +1260,7 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length) && ((c = next_char (dtp)) == 'n' || c == 'N') && (c = next_char (dtp))) { - if (is_separator (c)) + if (is_separator (c) || (c == EOF)) unget_char (dtp, c); push_char (dtp, 'n'); push_char (dtp, 'a'); @@ -1269,7 +1274,7 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length) goto bad; c = next_char (dtp); - if (is_separator (c)) + if (is_separator (c) || (c == EOF)) unget_char (dtp, c); } goto done_infnan; @@ -1315,6 +1320,7 @@ read_complex (st_parameter_dt *dtp, void * dest, int kind, size_t size) break; CASE_SEPARATORS: + case EOF: unget_char (dtp, c); eat_separator (dtp); return; @@ -1369,7 +1375,7 @@ eol_4: goto bad_complex; c = next_char (dtp); - if (!is_separator (c)) + if (!is_separator (c) && (c != EOF)) goto bad_complex; unget_char (dtp, c); @@ -1429,6 +1435,7 @@ read_real (st_parameter_dt *dtp, void * dest, int length) goto got_sign; CASE_SEPARATORS: + case EOF: unget_char (dtp, c); /* Single null. */ eat_separator (dtp); return; @@ -1484,6 +1491,7 @@ read_real (st_parameter_dt *dtp, void * dest, int length) goto got_repeat; CASE_SEPARATORS: + case EOF: if (c != '\n' && c != ',' && c != '\r' && c != ';') unget_char (dtp, c); goto done; @@ -1612,6 +1620,7 @@ read_real (st_parameter_dt *dtp, void * dest, int length) break; CASE_SEPARATORS: + case EOF: goto done; default: @@ -1647,7 +1656,7 @@ read_real (st_parameter_dt *dtp, void * dest, int length) goto unwind; c = next_char (dtp); l_push_char (dtp, c); - if (!is_separator (c)) + if (!is_separator (c) && (c != EOF)) { if (c != 'i' && c != 'I') goto unwind; @@ -1700,7 +1709,7 @@ read_real (st_parameter_dt *dtp, void * dest, int length) } } - if (!is_separator (c)) + if (!is_separator (c) && (c != EOF)) goto unwind; if (dtp->u.p.namelist_mode) @@ -2537,16 +2546,16 @@ nml_read_obj (st_parameter_dt *dtp, namelist_info * nl, index_type offset, switch (nl->type) { case BT_INTEGER: - read_integer (dtp, len); - break; + read_integer (dtp, len); + break; case BT_LOGICAL: - read_logical (dtp, len); - break; + read_logical (dtp, len); + break; case BT_CHARACTER: - read_character (dtp, len); - break; + read_character (dtp, len); + break; case BT_REAL: /* Need to copy data back from the real location to the temp in order |