https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93148
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> --- Additionally, it seems as if the contiguous check used for gfortran.dg/contiguous_10.f90 currently unconditionally copies in the data – which causes a problem when the pointer address escapes. (Okay, whether that works is implementation defined per F2018:15.5.2.4 paragraph 9, but it is still a missed optimizion.) – Lightly related to the issue above as the issue shows up with copy-in/copy-out. Possible fix - which causes a multi-call issue for gfortran.dg/contiguous_10.f90, see previous comment: --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -6528,5 +6528,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, gfc_conv_subref_array_arg (&parmse, e, nodesc_arg, fsym->attr.intent, - fsym->attr.pointer); + fsym->attr.pointer, fsym, + sym->name, NULL, + /* check_contiguous= */ true); } else