Hi Paul,

In
@@ -1335,19 +1340,49 @@ get_class_info_from_ss (stmtblock_t * pre, gfc_ss *ss,
tree *eltype) rhs_function = true;
     }
<SNIPP>
     }
+  else if (cntnr != NULL_TREE)
+    {
+      tmp = gfc_class_vptr_get (rhs_class_expr);
+      gfc_add_modify (pre, tmp, fold_convert (TREE_TYPE (tmp),
+                                             gfc_class_vptr_get (cntnr)));
+      if (unlimited_rhs)
+       {
+         tmp = gfc_class_len_get (rhs_class_expr);
+         if (unlimited_arg1)
+           gfc_add_modify (pre, tmp, gfc_class_len_get (cntnr));
+       }
+      tmp = NULL_TREE;
+    }
   else
     tmp = NULL_TREE;

I am confused here, because you are assigning to rhs. When that is correct, why
is there no else assigning zero to the rhs->_len when arg1 is not unlimited?

@@ -1176,6 +1176,21 @@ gfc_conv_class_to_class (gfc_se *parmse, gfc_expr *e,
gfc_typespec class_ts, stmtblock_t block;
   bool full_array = false;

+  /* Class transformational function results are the data field of a class
+     temporary and so the class expression canbe obtained directly.  */

s/canbe/can be/


Besides those small knits the patch looks fine to me. I am wondering though,
why gfortran is still using a non-class aware pack? To "move" the content of a
class object the _copy function of the vtype is to be used, right? In my
current PR I try to implement a class aware internal pack (and unpack) to
correctly apply the element sequence as of F2018 15.5.2.11. But I am
struggling when the rank changes. I found the idea how to do this correctly in
your code, thanks.

Regards,
        Andre


On Mon, 1 Jul 2024 22:17:11 +0100
Paul Richard Thomas <paul.richard.tho...@gmail.com> wrote:

> Hi All,
>
> This is one of those PRs where one thing led to another.... I think that
> the patch is pretty complete and, while apparently quite heavy, is more or
> less self explanatory through comments and the ChangeLog.
>
> The first testcase concentrates on reshape in various guises, while the
> second deals with all the other affected transformational intrinsic
> functions. In the first, most of the test statements are factored out into
> their own subroutines in order to expose the code generated for each. This
> was essential for the debugging but can be undone if preferred.
>
> Regtests just fine - OK for mainline?
>
> Paul


--
Andre Vehreschild * Email: vehre ad gmx dot de

Reply via email to