summaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>2016-02-23 18:38:31 +0000
committerjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>2016-02-23 18:38:31 +0000
commit4772d9d5968f4533eba63880ecca8434d2ae7ad6 (patch)
treef181cd7389d8bad1a96d98fe725f9b3dc253f400 /libgfortran
parent8c38d887ade4c98edf85f2251cfd37ae5f6a82c7 (diff)
downloadgcc-4772d9d5968f4533eba63880ecca8434d2ae7ad6.tar.gz
2016-02-23 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/69456 * io/list_read.c (read_real): If digit is missing from exponent issue an error. (parse_real): Likewise and adjusted error message to clarify it is part of a complex number. (nml_read_obj): Bump item count and add comment that this is used to identify which item in a namelist read has a problem. PR libgfortran/69456 * gfortran.dg/namelist_89.f90: New test. * gfortran.dg/pr59700.f90: Update test.. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233641 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog9
-rw-r--r--libgfortran/io/list_read.c14
2 files changed, 19 insertions, 4 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 436b598443a..4d10b2779e4 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,12 @@
+2016-02-23 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libgfortran/69456
+ * io/list_read.c (read_real): If digit is missing from exponent issue
+ an error. (parse_real): Likewise and adjusted error message to clarify
+ it is part of a complex number.
+ (nml_read_obj): Bump item count and add comment that this is used to
+ identify which item in a namelist read has a problem.
+
2016-02-17 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/69651
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index bebdd8cf301..e24b3922631 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -1374,7 +1374,7 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length)
exp2:
if (!isdigit (c))
- goto bad;
+ goto bad_exponent;
push_char (dtp, c);
@@ -1472,6 +1472,8 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length)
if (nml_bad_return (dtp, c))
return 0;
+ bad_exponent:
+
free_saved (dtp);
if (c == EOF)
{
@@ -1482,8 +1484,8 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length)
else if (c != '\n')
eat_line (dtp);
- snprintf (message, MSGLEN, "Bad floating point number for item %d",
- dtp->u.p.item_count);
+ snprintf (message, MSGLEN, "Bad complex floating point "
+ "number for item %d", dtp->u.p.item_count);
free_line (dtp);
generate_error (&dtp->common, LIBERROR_READ_VALUE, message);
@@ -1814,7 +1816,8 @@ read_real (st_parameter_dt *dtp, void * dest, int length)
exp2:
if (!isdigit (c))
- goto bad_real;
+ goto bad_exponent;
+
push_char (dtp, c);
for (;;)
@@ -1983,6 +1986,8 @@ read_real (st_parameter_dt *dtp, void * dest, int length)
if (nml_bad_return (dtp, c))
return;
+ bad_exponent:
+
free_saved (dtp);
if (c == EOF)
{
@@ -2810,6 +2815,7 @@ nml_read_obj (st_parameter_dt *dtp, namelist_info * nl, index_type offset,
if (dtp->u.p.nml_read_error || !nl->touched)
return true;
+ dtp->u.p.item_count++; /* Used in error messages. */
dtp->u.p.repeat_count = 0;
eat_spaces (dtp);