aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
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 /gcc/fortran
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 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog8
-rw-r--r--gcc/fortran/trans-io.c17
2 files changed, 22 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 928e5bb..76418d9 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,11 @@
+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 David Malcolm <dmalcolm@redhat.com>
PR fortran/79852
diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c
index c557c11..c3c56f2 100644
--- a/gcc/fortran/trans-io.c
+++ b/gcc/fortran/trans-io.c
@@ -1613,6 +1613,10 @@ nml_get_addr_expr (gfc_symbol * sym, gfc_component * c,
tmp = fold_build3_loc (input_location, COMPONENT_REF, TREE_TYPE (tmp),
base_addr, tmp, NULL_TREE);
+ if (GFC_CLASS_TYPE_P (TREE_TYPE (tmp))
+ && GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (gfc_class_data_get (tmp))))
+ tmp = gfc_class_data_get (tmp);
+
if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (tmp)))
tmp = gfc_conv_array_data (tmp);
else
@@ -1670,8 +1674,12 @@ transfer_namelist_element (stmtblock_t * block, const char * var_name,
/* Build ts, as and data address using symbol or component. */
- ts = (sym) ? &sym->ts : &c->ts;
- as = (sym) ? sym->as : c->as;
+ ts = sym ? &sym->ts : &c->ts;
+
+ if (ts->type != BT_CLASS)
+ as = sym ? sym->as : c->as;
+ else
+ as = sym ? CLASS_DATA (sym)->as : CLASS_DATA (c)->as;
addr_expr = nml_get_addr_expr (sym, c, base_addr);
@@ -1680,9 +1688,12 @@ transfer_namelist_element (stmtblock_t * block, const char * var_name,
if (rank)
{
- decl = (sym) ? sym->backend_decl : c->backend_decl;
+ decl = sym ? sym->backend_decl : c->backend_decl;
if (sym && sym->attr.dummy)
decl = build_fold_indirect_ref_loc (input_location, decl);
+
+ if (ts->type == BT_CLASS)
+ decl = gfc_class_data_get (decl);
dt = TREE_TYPE (decl);
dtype = gfc_get_dtype (dt);
}