https://gcc.gnu.org/g:4f41ab12922d80f19f9f56dba00c3468d2240812
commit 4f41ab12922d80f19f9f56dba00c3468d2240812 Author: Mikael Morin <mik...@gcc.gnu.org> Date: Fri Jan 24 16:55:57 2025 +0100 Correction regression contiguous-2.f90 Diff: --- gcc/fortran/trans-decl.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc index 19348c167388..1a9eb3f00d17 100644 --- a/gcc/fortran/trans-decl.cc +++ b/gcc/fortran/trans-decl.cc @@ -7225,6 +7225,11 @@ gfc_conv_cfi_to_gfc (stmtblock_t *init, stmtblock_t *finally, stmtblock_t block2; gfc_init_block (&block2); + do_copy_inout = + (sym->ts.type == BT_CHARACTER && !sym->ts.u.cl->length + && (sym->as->type == AS_ASSUMED_SIZE || sym->as->type == AS_EXPLICIT)) + || sym->attr.contiguous; + gfc_set_gfc_from_cfi (&block, &block2, gfc_desc, cfi, rank, sym, true, do_copy_inout, false); @@ -7232,11 +7237,8 @@ gfc_conv_cfi_to_gfc (stmtblock_t *init, stmtblock_t *finally, handle noncontiguous arrays passed to an dummy with 'contiguous' attribute and with character(len=*) + assumed-size/explicit-size arrays. cf. Fortran 2018, 18.3.6, paragraph 5 (and for the caller: para. 6). */ - if ((sym->ts.type == BT_CHARACTER && !sym->ts.u.cl->length - && (sym->as->type == AS_ASSUMED_SIZE || sym->as->type == AS_EXPLICIT)) - || sym->attr.contiguous) + if (do_copy_inout) { - do_copy_inout = true; gcc_assert (!sym->attr.pointer); stmtblock_t block2; tree data;