summaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2014-03-18 01:20:02 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2014-03-18 01:20:02 +0000
commite34994fcff3c514e35f0b47b0ad93e71b98ae583 (patch)
treea6a707090c6c402e96bc2a3a2e63924cea43d80b /libgfortran
parentd65e2594fbfacec1fb0ba72d5ed93ec01dfda494 (diff)
downloadgcc-e34994fcff3c514e35f0b47b0ad93e71b98ae583.tar.gz
re PR libfortran/46800 (Handle CTRL-D correctly with STDIN)
2014-03-17 Jerry DeLisle <jvdelisle@gcc.gnu> PR libfortran/46800 * io/list_read.c (list_formatted_read_scalar): Do not use eat_separator. Explicitly set the comma and end-of-line flags. Check for END condition from finish_separator. From-SVN: r208629
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog7
-rw-r--r--libgfortran/io/list_read.c30
2 files changed, 29 insertions, 8 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 358a31cbe5a..69d56275059 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,10 @@
+2014-03-17 Jerry DeLisle <jvdelisle@gcc.gnu>
+
+ PR libfortran/58324
+ * io/list_read.c (list_formatted_read_scalar): Do not use
+ eat_separator. Explicitly set the comma and end-of-line flags.
+ Check for END condition from finish_separator.
+
2014-03-15 Jerry DeLisle <jvdelisle@gcc.gnu>
PR libfortran/58324
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index caeb41b0782..625ba0c8594 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -1923,17 +1923,31 @@ list_formatted_read_scalar (st_parameter_dt *dtp, bt type, void *p,
}
if (is_separator (c))
{
- /* Found a null value. */
- eat_separator (dtp);
+ /* Found a null value. Do not use eat_separator here otherwise
+ we will do an extra read from stdin. */
dtp->u.p.repeat_count = 0;
- /* eat_separator sets this flag if the separator was a comma. */
- if (dtp->u.p.comma_flag)
- goto cleanup;
+ /* Set comma_flag. */
+ if ((c == ';'
+ && dtp->u.p.current_unit->decimal_status == DECIMAL_COMMA)
+ ||
+ (c == ','
+ && dtp->u.p.current_unit->decimal_status == DECIMAL_POINT))
+ {
+ dtp->u.p.comma_flag = 1;
+ goto cleanup;
+ }
- /* eat_separator sets this flag if the separator was a \n or \r. */
- if (dtp->u.p.at_eol)
- finish_separator (dtp);
+ /* Set end-of-line flag. */
+ if (c == '\n' || c == '\r')
+ {
+ dtp->u.p.at_eol = 1;
+ if (finish_separator (dtp) == LIBERROR_END)
+ {
+ err = LIBERROR_END;
+ goto cleanup;
+ }
+ }
else
goto cleanup;
}