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

--- Comment #11 from Harald Anlauf <anlauf at gcc dot gnu.org> ---
(In reply to Mikael Morin from comment #9)
> (In reply to Harald Anlauf from comment #5)
> > but am unable to construct an
> > example where transposed dimensions occur and which can be passed to
> > target, contiguous dummy which can be associated with the actual.
> I don't understand what you are looking for.  The original testcase doesn't
> fit?

I thought about a user defined function which could return a pointer that
is non-contiguous and to be passed as actual to the target, contiguous dummy.
Other than TRANSPOSE.

> 
> (In reply to Harald Anlauf from comment #7)
> > Another part of the issue is that gfc_expr_is_variable has:
> > 
> >   arg = gfc_get_noncopying_intrinsic_argument (expr);
> >   if (arg)
> >     {
> >       gcc_assert (expr->value.function.isym->id == GFC_ISYM_TRANSPOSE);
> >       return gfc_expr_is_variable (arg);
> >     }
> > 
> > This seems to be your code, Mikael.
> > We could try to suppress this exception.
> Heh, no, the exception is important to gfc_expr_is_variable.
> 
> (In reply to Harald Anlauf from comment #8)
> > (In reply to Harald Anlauf from comment #7)
> > > This seems to be your code, Mikael.
> > > We could try to suppress this exception.
> > 
> > Like:
> > 
> > diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
> > index 9108e92b446..a18701763e2 100644
> > --- a/gcc/fortran/trans-expr.cc
> > +++ b/gcc/fortran/trans-expr.cc
> > @@ -8045,6 +8047,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * 
> > sym,
> >                        ? gfc_is_not_contiguous (e)
> >                        : !gfc_is_simply_contiguous (e, false, true))
> >                    && gfc_expr_is_variable (e)
> > +                  && gfc_get_noncopying_intrinsic_argument (e) == NULL
> >                    && e->rank != -1)
> >             {
> >               gfc_conv_subref_array_arg (&parmse, e, nodesc_arg,
> OK, like this it's acceptable.

Or:

diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index 9108e92b446..6f5cc998e19 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -8041,7 +8043,8 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
                                             INTENT_IN, fsym->attr.pointer);
                }
              else if (fsym && fsym->attr.contiguous
-                      && (fsym->attr.target
+                      && ((fsym->attr.target
+                           && !gfc_get_noncopying_intrinsic_argument (e))
                           ? gfc_is_not_contiguous (e)
                           : !gfc_is_simply_contiguous (e, false, true))
                       && gfc_expr_is_variable (e)

This would directly address the regression introduced by my patch.

> I have the impression that the problem is more in gfc_conv_subref_array_arg
> though.

But we do want a temporary here, don't we?

Reply via email to