aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/write.c
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2017-03-11 14:49:57 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2017-03-11 14:49:57 +0000
commitc08de9db47cea407e4399c987d2b8b9b6a6413ed (patch)
tree0c0816499c2d1669fe279e6c7c3afde3190d275d /libgfortran/io/write.c
parent85059a38cba2e84d0242f5d0b835ab95ad4b4965 (diff)
downloadgcc-c08de9db47cea407e4399c987d2b8b9b6a6413ed.zip
gcc-c08de9db47cea407e4399c987d2b8b9b6a6413ed.tar.gz
gcc-c08de9db47cea407e4399c987d2b8b9b6a6413ed.tar.bz2
re PR fortran/78854 ([F03] DTIO namelist output not working on internal unit)
2017-03-11 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/78854 * io/list_read.c (nml_get_obj_data): Stash internal unit for later use by child procedures. * io/write.c (nml_write_obj): Likewise. * io/tranfer.c (data_transfer_init): Minor whitespace. * io/unit.c (set_internal_uit): Look for the stashed internal unit and use it if found. * gfortran.dg/dtio_25.f90: New test. From-SVN: r246070
Diffstat (limited to 'libgfortran/io/write.c')
-rw-r--r--libgfortran/io/write.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c
index 47970d4..f03929e 100644
--- a/libgfortran/io/write.c
+++ b/libgfortran/io/write.c
@@ -2253,6 +2253,12 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info * obj, index_type offset,
child_iomsg_len = IOMSG_LEN;
}
namelist_write_newline (dtp);
+
+ /* If writing to an internal unit, stash it to allow
+ the child procedure to access it. */
+ if (is_internal_unit (dtp))
+ stash_internal_unit (dtp);
+
/* Call the user defined formatted WRITE procedure. */
dtp->u.p.current_unit->child_dtio++;
dtio_ptr ((void *)&list_obj, &unit, iotype, &vlist,