https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99266
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
I tried to add to gfc_build_class_symbol:
if (attr->class_ok
&& ((attr->allocatable && !ts->u.derived->components->attr.allocatable)
|| (attr->pointer && !ts->u.derived->components->attr.class_pointer)
|| (*as && !ts->u.derived->components->as)
|| (attr->dimension && !ts->u.derived->components->attr.dimension)
|| (attr->codimension
&& !ts->u.derived->components->attr.codimension)))
attr->class_ok = 0;
but that did not work - For 's2', dimension == 1 but *as == NULL !!!