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

--- Comment #2 from anlauf at gcc dot gnu.org ---
A further problem found while checking gfc_simplify_is_contiguous:

diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc
index 00abd9e8734..77608c9374b 100644
--- a/gcc/fortran/expr.cc
+++ b/gcc/fortran/expr.cc
@@ -6406,6 +6455,10 @@ gfc_is_simply_contiguous (gfc_expr *expr, bool strict,
bool permit_element)
              || (sym->as && sym->as->type == AS_ASSUMED_SHAPE))))
     return false;

+  /* An associate variable may point to a non-contiguous target.  */
+  if (ar && sym->attr.associate_var && !sym->attr.contiguous)
+    return false;
+
   if (!ar || ar->type == AR_FULL)
     return true;

Reply via email to