https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125059
--- Comment #10 from anlauf at gcc dot gnu.org ---
(In reply to anlauf from comment #9)
> (In reply to Jerry DeLisle from comment #8)
> > This seems to fix this:
> >
> > diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc
> > index 4b3f75ced71..ae451da04e8 100644
> > --- a/gcc/fortran/trans-decl.cc
> > +++ b/gcc/fortran/trans-decl.cc
> > @@ -764,7 +764,7 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym)
> > && sym->ts.u.derived->attr.has_dtio_procs)
> > || (sym->ts.type == BT_CLASS
> > && CLASS_DATA (sym)->ts.u.derived->attr.has_dtio_procs)))
> > - TREE_STATIC (decl) = 1;
> > + TREE_THIS_VOLATILE (decl) = 1;
> >
> > /* Treat asynchronous variables the same as volatile, for now. */
> > if (sym->attr.volatile_ || sym->attr.asynchronous)
> Maybe we are barking up the wrong tree, and the issue is actually
> with the read!
>
> Should it set the variable udt1 as modified?
Actually commenting the code fragment above and applying this patch works!
diff --git a/gcc/fortran/trans-io.cc b/gcc/fortran/trans-io.cc
index a18b2bca6aa..046fb57bcd0 100644
--- a/gcc/fortran/trans-io.cc
+++ b/gcc/fortran/trans-io.cc
@@ -416,7 +416,7 @@ gfc_build_io_library_fndecls (void)
integer_type_node, gfc_charlen_type_node);
iocall[IOCALL_X_DERIVED] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("transfer_derived")), ". w r ",
+ get_identifier (PREFIX("transfer_derived")), ". w w ",
void_type_node, 2, dt_parm_type, pvoid_type_node);
/* Library entry points */
Can this be correct?