summaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2013-04-04 11:24:15 +0000
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2013-04-04 11:24:15 +0000
commit6f6f638b0db7c4784667a944efc38942efdc658b (patch)
treedf5329c928c8cf6fa8d1e32ec60361ab9daeeac9 /libgfortran
parent616d052d46b0b972458af7c4db2c565bac93b470 (diff)
downloadgcc-6f6f638b0db7c4784667a944efc38942efdc658b.tar.gz
2013-04-04 Tobias Burnus <burnus@net-b.de>
PR fortran/56810 * io/list_read.c (check_type): Fix kind checking for COMPLEX. 2013-04-04 Tobias Burnus <burnus@net-b.de> PR fortran/56810 * gfortran.dg/read_repeat_2.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@197479 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog5
-rw-r--r--libgfortran/io/list_read.c9
2 files changed, 11 insertions, 3 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index fe9ae95a855..a963d45d2f1 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,8 @@
+2013-04-04 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/56810
+ * io/list_read.c (check_type): Fix kind checking for COMPLEX.
+
2013-04-01 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/56660
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index 0693e50f4aa..b29fdcd2306 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -1784,7 +1784,7 @@ read_real (st_parameter_dt *dtp, void * dest, int length)
compatible. Returns nonzero if incompatible. */
static int
-check_type (st_parameter_dt *dtp, bt type, int len)
+check_type (st_parameter_dt *dtp, bt type, int kind)
{
char message[MSGLEN];
@@ -1801,11 +1801,14 @@ check_type (st_parameter_dt *dtp, bt type, int len)
if (dtp->u.p.saved_type == BT_UNKNOWN || dtp->u.p.saved_type == BT_CHARACTER)
return 0;
- if (dtp->u.p.saved_length != len)
+ if ((type != BT_COMPLEX && dtp->u.p.saved_length != kind)
+ || (type == BT_COMPLEX && dtp->u.p.saved_length != kind*2))
{
snprintf (message, MSGLEN,
"Read kind %d %s where kind %d is required for item %d",
- dtp->u.p.saved_length, type_name (dtp->u.p.saved_type), len,
+ type == BT_COMPLEX ? dtp->u.p.saved_length / 2
+ : dtp->u.p.saved_length,
+ type_name (dtp->u.p.saved_type), kind,
dtp->u.p.item_count);
generate_error (&dtp->common, LIBERROR_READ_VALUE, message);
return 1;