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

--- Comment #3 from Steve Kargl <kargl at gcc dot gnu.org> ---
This patch allows Ivan's code to compile and execute.
It is otherwise untested.

diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc
index a47e970eda9..4cd90d88050 100644
--- a/gcc/fortran/expr.cc
+++ b/gcc/fortran/expr.cc
@@ -6557,8 +6557,14 @@ gfc_is_not_contiguous (gfc_expr *array)
     {
       /* Array-ref shall be last ref.  */

-      if (ar && ar->type != AR_ELEMENT)
-       return true;
+      if (ar)
+       {
+         /* Check for 'a(:)%x'  */
+         if (ref->type == REF_COMPONENT)
+           return gfc_is_simply_contiguous (array, false, false);
+         else if (ar->type != AR_ELEMENT)
+           return true;
+       }

       if (ref->type == REF_ARRAY)
        ar = &ref->u.ar;

Reply via email to