bool rank_check, is_pointer;
char err[200];
gfc_component *ppc;
+ bool codimension = false;
/* If the formal arg has type BT_VOID, it's to one of the iso_c_binding
procs c_f_pointer or c_f_procpointer, and we need to accept most
return false;
}
- if (formal->attr.codimension && !gfc_is_coarray (actual))
+ if (formal->ts.type == BT_CLASS && formal->attr.class_ok)
+ codimension = CLASS_DATA (formal)->attr.codimension;
+ else
+ codimension = formal->attr.codimension;
+
+ if (codimension && !gfc_is_coarray (actual))
{
if (where)
gfc_error ("Actual argument to %qs at %L must be a coarray",
return false;
}
- if (formal->attr.codimension && formal->attr.allocatable)
+ if (codimension && formal->attr.allocatable)
{
gfc_ref *last = NULL;
}
}
- if (formal->attr.codimension)
+ if (codimension)
{
/* F2008, 12.5.2.8 + Corrig 2 (IR F08/0048). */
/* F2018, 12.5.2.8. */
return false;
}
- if (formal->attr.allocatable && !formal->attr.codimension
+ if (formal->attr.allocatable && !codimension
&& actual_attr.codimension)
{
if (formal->attr.intent == INTENT_OUT)
--- /dev/null
+! { dg-do compile }
+! { dg-options "-fcoarray=lib" }
+!
+! Fix for P99818 in which wrong code caused an ICE.
+!
+! Contributed by Gerhard Steinmetz <gscfq@t-online.de>
+!
+module m
+ type t
+ integer :: a
+ contains
+ procedure :: s
+ end type
+contains
+ subroutine s(x)
+ class(t) :: x[*]
+ end
+end
+program p
+ use m
+ associate (y => t(1))
+ call y%s ! { dg-error "must be a coarray" }
+ end associate
+end