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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |anlauf at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-12-20

--- Comment #1 from anlauf at gcc dot gnu.org ---
Testing the following obvious patch:

diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 52bc5af7542..49a9e933ea3 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -6088,6 +6088,19 @@ match_case_selector (gfc_case **cp)
        }
     }

+  if (c->low && c->low->rank != 0)
+    {
+      gfc_error ("Expression in CASE statement at %L must be scalar",
+                &c->low->where);
+      goto cleanup;
+    }
+  if (c->high && c->high->rank != 0)
+    {
+      gfc_error ("Expression in CASE statement at %L must be scalar",
+                &c->high->where);
+      goto cleanup;
+    }
+
   *cp = c;
   return MATCH_YES;

Reply via email to