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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |anlauf at gcc dot 
gnu.org

--- Comment #6 from anlauf at gcc dot gnu.org ---
(In reply to anlauf from comment #3)
> It looks like argument association is confused here.
> (The F2018 reference is 15.5.2.3 and 15.5.2.4).
> 
> The following patch appears to fix the testcase:
> 
> diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
> index 06713f24f95..c7fb4633ab1 100644
> --- a/gcc/fortran/trans-expr.cc
> +++ b/gcc/fortran/trans-expr.cc
> @@ -6854,7 +6854,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
>                                              INTENT_IN, fsym->attr.pointer);
>                 }
>               else if (fsym && fsym->attr.contiguous
> -                      && !gfc_is_simply_contiguous (e, false, true)
> +                      && gfc_is_not_contiguous (e)
>                        && gfc_expr_is_variable (e))
>                 {
>                   gfc_conv_subref_array_arg (&parmse, e, nodesc_arg,
> 
> but unfortunately regresses on gfortran.dg/bind-c-contiguous-3.f90 :-(

This works:

diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index b2463a28748..7bc6d72decc 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -7124,7 +7125,9 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
                                             INTENT_IN, fsym->attr.pointer);
                }
              else if (fsym && fsym->attr.contiguous
-                      && !gfc_is_simply_contiguous (e, false, true)
+                      && (fsym->attr.target
+                          ? gfc_is_not_contiguous (e)
+                          : !gfc_is_simply_contiguous (e, false, true))
                       && gfc_expr_is_variable (e))
                {
                  gfc_conv_subref_array_arg (&parmse, e, nodesc_arg,

Reply via email to