[Bug fortran/97592] Incorrectly set pointer remapping with array pointer argument to CONTIGUOUS dummy

2022-03-14 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97592

--- Comment #3 from anlauf at gcc dot gnu.org ---
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 (, e, nodesc_arg,

but unfortunately regresses on gfortran.dg/bind-c-contiguous-3.f90 :-(

[Bug fortran/97592] Incorrectly set pointer remapping with array pointer argument to CONTIGUOUS dummy

2021-02-14 Thread dominiq at lps dot ens.fr via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97592

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
   Last reconfirmed||2021-02-14

--- Comment #2 from Dominique d'Humieres  ---
> Workaround: add CONTIGUOUS to the declaration of B_2D.

Confirmed for GCC9 up to GCC11. Note that GCC7 and GCC8 give the expected
result without the CONTIGUOUS attribute.

[Bug fortran/97592] Incorrectly set pointer remapping with array pointer argument to CONTIGUOUS dummy

2020-10-27 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97592

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 CC||anlauf at gcc dot gnu.org

--- Comment #1 from anlauf at gcc dot gnu.org ---
gfortran seems to see the CONTIGUOUS attribute in the declaration of the
dummy argument C_2D of SetPointer, but no corresponding attribute to B_2D.

Workaround: add CONTIGUOUS to the declaration of B_2D.