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

--- Comment #17 from Paul Thomas <pault at gcc dot gnu.org> ---
(In reply to Paul Thomas from comment #14)
> (In reply to Paul Thomas from comment #13)
> > (In reply to Tomáš Trnka from comment #12)
> > 
> 
> So, not only is the allocatable case not using the defined assignment but
> the finalization after the call to subroutine assign, uses the original
> value for 'y'.

diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index d479b6a80e5..d12bf6100a1 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -13875,7 +13875,7 @@ generate_component_assignments (gfc_code **code,
gfc_namespace *ns)
         of all kinds and allocatable components.  */
       if (!gfc_bt_struct (comp1->ts.type)
          || comp1->attr.pointer
-         || comp1->attr.allocatable
+         || (comp1->attr.allocatable && (*code)->expr1->rank)
          || comp1->attr.proc_pointer_comp
          || comp1->attr.class_pointer
          || comp1->attr.proc_pointer)

Corrects the first problem. However, it fails if either of y or ya have
non-zero dimensions.

resolve.cc:13793 -   /* TODO: Handle more than one part array reference in
assignments.  */

This effectively requires a front-end scalarizer - copy the generation of the
final wrapper?

Paul

Reply via email to