summaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>2011-02-17 05:19:50 +0000
committerjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>2011-02-17 05:19:50 +0000
commit81f7092bb8ce75416582d69d24af6a288867b886 (patch)
treef87711fb887cbf2edcd329c147ad7dc9b65f68cf /libgfortran
parenta7c89d09b9dbc4baf82d77f024a6d1add755f1e9 (diff)
downloadgcc-81f7092bb8ce75416582d69d24af6a288867b886.tar.gz
2011-02-16 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/47567 * io/list_read.c (read_logical): Check for end of line before calling eat_line. (read_integer): Likewise. (parse_real): Don't unget the separator. Check for end of line before calling eat_line. (read_complex): Allow line-end before and after parenthesis and comma. Check for end of line before calling eat_line. (read_real): Check for end of line before calling eat_line. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170239 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog10
-rw-r--r--libgfortran/io/list_read.c37
2 files changed, 36 insertions, 11 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 44a562a11ad..7371e8e2be1 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,13 @@
+2011-02-16 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libgfortran/47567
+ * io/list_read.c (read_logical): Check for end of line before calling
+ eat_line. (read_integer): Likewise. (parse_real): Don't unget the
+ separator. Check for end of line before calling eat_line.
+ (read_complex): Allow line-end before and after parenthesis and comma.
+ Check for end of line before calling eat_line. (read_real): Check for
+ end of line before calling eat_line.
+
2011-02-16 Jakub Jelinek <jakub@redhat.com>
PR libfortran/47757
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index 9f8555ac8f4..9d797cc270d 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -768,7 +768,7 @@ read_logical (st_parameter_dt *dtp, int length)
hit_eof (dtp);
return;
}
- else
+ else if (c != '\n')
eat_line (dtp);
sprintf (message, "Bad logical value while reading item %d",
dtp->u.p.item_count);
@@ -906,7 +906,7 @@ read_integer (st_parameter_dt *dtp, int length)
hit_eof (dtp);
return;
}
- else
+ else if (c != '\n')
eat_line (dtp);
sprintf (message, "Bad integer for item %d in list input",
dtp->u.p.item_count);
@@ -1104,6 +1104,7 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length)
if ((c = next_char (dtp)) == EOF)
goto bad;
+
if (c == '-' || c == '+')
{
push_char (dtp, c);
@@ -1162,7 +1163,6 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length)
goto exp2;
CASE_SEPARATORS:
- unget_char (dtp, c);
goto done;
default:
@@ -1273,7 +1273,7 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length)
hit_eof (dtp);
return 1;
}
- else
+ else if (c != '\n')
eat_line (dtp);
sprintf (message, "Bad floating point number for item %d",
dtp->u.p.item_count);
@@ -1310,15 +1310,22 @@ read_complex (st_parameter_dt *dtp, void * dest, int kind, size_t size)
goto bad_complex;
}
+eol_1:
eat_spaces (dtp);
+ c = next_char (dtp);
+ if (c == '\n' || c== '\r')
+ goto eol_1;
+ else
+ unget_char (dtp, c);
+
if (parse_real (dtp, dest, kind))
return;
-eol_1:
+eol_2:
eat_spaces (dtp);
c = next_char (dtp);
if (c == '\n' || c== '\r')
- goto eol_1;
+ goto eol_2;
else
unget_char (dtp, c);
@@ -1326,18 +1333,25 @@ eol_1:
!= (dtp->u.p.current_unit->decimal_status == DECIMAL_POINT ? ',' : ';'))
goto bad_complex;
-eol_2:
+eol_3:
eat_spaces (dtp);
c = next_char (dtp);
if (c == '\n' || c== '\r')
- goto eol_2;
+ goto eol_3;
else
unget_char (dtp, c);
if (parse_real (dtp, dest + size / 2, kind))
return;
-
+
+eol_4:
eat_spaces (dtp);
+ c = next_char (dtp);
+ if (c == '\n' || c== '\r')
+ goto eol_4;
+ else
+ unget_char (dtp, c);
+
if (next_char (dtp) != ')')
goto bad_complex;
@@ -1363,7 +1377,7 @@ eol_2:
hit_eof (dtp);
return;
}
- else
+ else if (c != '\n')
eat_line (dtp);
sprintf (message, "Bad complex value in item %d of list input",
dtp->u.p.item_count);
@@ -1726,8 +1740,9 @@ read_real (st_parameter_dt *dtp, void * dest, int length)
hit_eof (dtp);
return;
}
- else
+ else if (c != '\n')
eat_line (dtp);
+
sprintf (message, "Bad real number in item %d of list input",
dtp->u.p.item_count);
generate_error (&dtp->common, LIBERROR_READ_VALUE, message);