https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125391
--- Comment #7 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Paul Thomas from comment #6)
>
> This does the trick and regression tests OK:
>
> diff --git a/gcc/fortran/trans.cc b/gcc/fortran/trans.cc
> index 1d7006a6963..c366d7f4dbf 100644
> --- a/gcc/fortran/trans.cc
> +++ b/gcc/fortran/trans.cc
> @@ -1570,7 +1570,10 @@ gfc_assignment_finalizer_call (gfc_se *lse, gfc_expr
> *expr1, bool init_flag)
> gfc_init_se (&se, NULL);
> if (expr1->rank)
> {
> - gfc_conv_expr_descriptor (&se, expr1);
> + /* Avoid calling trans-array.cc(set_factored_descriptor_value)
> by
> + not using gfc_conv_expr_descriptor. */
> + se.descriptor_only = 1;
> + gfc_conv_expr (&se, expr1);
> ptr = gfc_conv_descriptor_data_get (se.expr);
> }
> else
>
Looks good (and safe).
Feel free to push.