aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2017-05-19 15:48:35 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2017-05-19 15:48:35 +0000
commit51cd6b78eedaefec65059f7a8cbca1f2b9bf4878 (patch)
tree908bf66366979aea047bb5cdb52160fd2e75d187 /libgfortran
parent33f8c0a14da482bc7884e5f663615a3d7fd08cff (diff)
downloadgcc-51cd6b78eedaefec65059f7a8cbca1f2b9bf4878.zip
gcc-51cd6b78eedaefec65059f7a8cbca1f2b9bf4878.tar.gz
gcc-51cd6b78eedaefec65059f7a8cbca1f2b9bf4878.tar.bz2
[multiple changes]
2017-05-19 Paul Thomas <pault@gcc.gnu.org> PR fortran/80333 * trans-io.c (nml_get_addr_expr): If we are dealing with class type data set tmp tree to get that address. (transfer_namelist_element): Set the array spec to point to the the class data. 2017-05-19 Paul Thomas <pault@gcc.gnu.org> Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/80333 * list_read.c (nml_read_obj): Compute pointer into class/type arrays from the nl->dim information. Update it for each iteration of the loop for the given object. 2017-05-19 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/80333 * gfortran.dg/dtio_30.f03: New test. From-SVN: r248293
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog8
-rw-r--r--libgfortran/io/list_read.c33
2 files changed, 33 insertions, 8 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 7fe527d..4ada8b8 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,11 @@
+2017-05-19 Paul Thomas <pault@gcc.gnu.org>
+ Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/80333
+ * list_read.c (nml_read_obj): Compute pointer into class/type
+ arrays from the nl->dim information. Update it for each iteration
+ of the loop for the given object.
+
2017-05-17 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/80741
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index 9175a6b..6c00d11 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -2871,6 +2871,7 @@ nml_read_obj (st_parameter_dt *dtp, namelist_info *nl, index_type offset,
index_type m;
size_t obj_name_len;
void *pdata;
+ gfc_class list_obj;
/* If we have encountered a previous read error or this object has not been
touched in name parsing, just return. */
@@ -2909,11 +2910,28 @@ nml_read_obj (st_parameter_dt *dtp, namelist_info *nl, index_type offset,
{
/* Update the pointer to the data, using the current index vector */
- pdata = (void*)(nl->mem_pos + offset);
- for (dim = 0; dim < nl->var_rank; dim++)
- pdata = (void*)(pdata + (nl->ls[dim].idx
- - GFC_DESCRIPTOR_LBOUND(nl,dim))
- * GFC_DESCRIPTOR_STRIDE(nl,dim) * nl->size);
+ if ((nl->type == BT_DERIVED || nl->type == BT_CLASS)
+ && nl->dtio_sub != NULL)
+ {
+ pdata = NULL; /* Not used under these conidtions. */
+ if (nl->type == BT_CLASS)
+ list_obj.data = ((gfc_class*)nl->mem_pos)->data;
+ else
+ list_obj.data = (void *)nl->mem_pos;
+
+ for (dim = 0; dim < nl->var_rank; dim++)
+ list_obj.data = list_obj.data + (nl->ls[dim].idx
+ - GFC_DESCRIPTOR_LBOUND(nl,dim))
+ * GFC_DESCRIPTOR_STRIDE(nl,dim) * nl->size;
+ }
+ else
+ {
+ pdata = (void*)(nl->mem_pos + offset);
+ for (dim = 0; dim < nl->var_rank; dim++)
+ pdata = (void*)(pdata + (nl->ls[dim].idx
+ - GFC_DESCRIPTOR_LBOUND(nl,dim))
+ * GFC_DESCRIPTOR_STRIDE(nl,dim) * nl->size);
+ }
/* If we are finished with the repeat count, try to read next value. */
@@ -2958,6 +2976,7 @@ nml_read_obj (st_parameter_dt *dtp, namelist_info *nl, index_type offset,
break;
case BT_DERIVED:
+ case BT_CLASS:
/* If this object has a User Defined procedure, call it. */
if (nl->dtio_sub != NULL)
{
@@ -2970,13 +2989,11 @@ nml_read_obj (st_parameter_dt *dtp, namelist_info *nl, index_type offset,
int noiostat;
int *child_iostat = NULL;
gfc_array_i4 vlist;
- gfc_class list_obj;
formatted_dtio dtio_ptr = (formatted_dtio)nl->dtio_sub;
GFC_DESCRIPTOR_DATA(&vlist) = NULL;
GFC_DIMENSION_SET(vlist.dim[0],1, 0, 0);
-
- list_obj.data = (void *)nl->mem_pos;
+
list_obj.vptr = nl->vtable;
list_obj.len = 0;