https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78661

--- Comment #4 from janus at gcc dot gnu.org ---
I think this should fix it:


Index: libgfortran/io/write.c
===================================================================
--- libgfortran/io/write.c      (revision 243729)
+++ libgfortran/io/write.c      (working copy)
@@ -2076,7 +2076,7 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info
   /* Write namelist variable names in upper case. If a derived type,
      nothing is output.  If a component, base and base_name are set.  */

-  if (obj->type != BT_DERIVED)
+  if (obj->type != BT_DERIVED || obj->dtio_sub != NULL)
     {
       namelist_write_newline (dtp);
       write_character (dtp, " ", 1, 1, NODELIM);
@@ -2253,7 +2253,7 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info
                      child_iomsg = tmp_iomsg;
                      child_iomsg_len = IOMSG_LEN;
                    }
-                 namelist_write_newline (dtp);
+
                  /* Call the user defined formatted WRITE procedure.  */
                  dtp->u.p.current_unit->child_dtio++;
                  dtio_ptr ((void *)&list_obj, &unit, iotype, &vlist,

Reply via email to