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

--- Comment #2 from anlauf at gcc dot gnu.org ---
There are more testcases also with valid code which would ICE when using
CLASS and PARAMETER, or are rejected.  See also pr103137.

Another one:

program p
  type t
  end type
  class(t), parameter :: a(2) = t()
  integer,  parameter :: c(1) = shape (a)
end

The resulting ICE can be fixed,

--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -5096,6 +5106,9 @@ gfc_check_shape (gfc_expr *source, gfc_expr *kind)
   if (source->rank == 0 || source->expr_type != EXPR_VARIABLE)
     return true;

+  if (source->ref == NULL)
+    return false;
+
   ar = gfc_find_array_ref (source);

   if (ar->as && ar->as->type == AS_ASSUMED_SIZE && ar->type == AR_FULL)

but this gives a bogus error message.

Reply via email to