http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47569
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-02-01 14:54:10 UTC --- (In reply to comment #2) > Draft patch: > + || gfc_expr_attr (actual).pointer)))) That check won't work as "foo(1)" is never a pointer while "foo" might be a pointer; thus, one has to save the last REF_COMPONENT and handle it manually. The following check at a few lines later also needs to be modified (both the AS_ASSUMED and the pointer check). if (actual->expr_type == EXPR_VARIABLE && ref && (ref->u.ar.as->type == AS_ASSUMED_SHAPE || gfc_expr_attr (actual).pointer)) And the check: for (ref = actual->ref; ref; ref = ref->next) if (ref->type == REF_ARRAY && ref->u.ar.type == AR_ELEMENT && ref->u.ar.dimen > 0) break; seems to mishandle "foo(1)%bar(1)%foo" by looking only at the first AR_ELEMENT.