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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org
           Keywords|                            |rejects-valid

--- Comment #4 from anlauf at gcc dot gnu.org ---
The following patch seems to work:

diff --git a/gcc/fortran/check.cc b/gcc/fortran/check.cc
index 91d87a1b2c1..6365c4ab809 100644
--- a/gcc/fortran/check.cc
+++ b/gcc/fortran/check.cc
@@ -1502,8 +1502,17 @@ gfc_check_associated (gfc_expr *pointer, gfc_expr
*target)
     t = false;
   /* F2018 C838 explicitly allows an assumed-rank variable as the first
      argument of intrinsic inquiry functions.  */
-  if (pointer->rank != -1 && !rank_check (target, 0, pointer->rank))
-    t = false;
+  if (pointer->rank != -1 && target->rank != 1 && pointer->rank !=
target->rank)
+    {
+      if (gfc_option.warn_std & GFC_STD_F2003)
+       {
+         if (!rank_check (target, 0, pointer->rank))
+           t = false;
+       }
+      else if (!gfc_notify_std (GFC_STD_F2008, "Rank remapping target is not "
+                               "rank 1 at %L", &target->where))
+       t = false;
+    }
   if (target->rank > 0 && target->ref)
     {
       for (i = 0; i < target->rank; i++)

Needs regtesting.

Reply via email to