Hi Tobias, > > However, an additional plain check on e->rank != 0 also in the > > CLASS cases fixes the original issue as well as your example: > [...] > > And regtests ok. :-) > > See attached updated patch. > > I think you still need to remove the 'return true;' from > the 'if (e->rank != 0 && e->ts.type == BT_CLASS' block – to > fall through to the e->rank check after the block. > (When 'return true;' is gone, the '{' and '}' can also be removed.) > > Reason: Assume 'CLASS(...) x'. In this case, 'x' is a scalar. > And even after calling gfc_add_class_array_ref it remains > a scalar and e->rank == 0. > > Or in other words: I think with your current patch, > class(u) :: z > f = size (z) > is wrongly accepted without an error.
did you really check that? My related testing succeeded without and with the return (which was in the original commit by Paul). I have nevertheless followed your advice to remove the return statement, extended the testcase and regtested again. Committed as https://gcc.gnu.org/g:e314cfc371d8b2405a1d81e51b90f9fb24b9061f Thanks, Harald