https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104429
Tobias Burnus <burnus at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |burnus at gcc dot gnu.org --- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> --- The problem is that the following code works fine for: f(...) where f returns a CLASS but it does not work for: x % _vptr % op[[((p:x) (p:y))]] trans-expr.cc's gfc_conv_procedure_call if (fsym && (fsym->ts.type == BT_DERIVED || fsym->ts.type == BT_ASSUMED) && e->ts.type == BT_CLASS && !CLASS_DATA (e)->attr.dimension && !CLASS_DATA (e)->attr.codimension) { ... if (e->expr_type == EXPR_FUNCTION && CLASS_DATA (e)->attr.allocatable) { ... e->symtree->n.sym->attr.flavor = FL_PROCEDURE; That works kind of fine – until: x % _vptr % assign ( ... ) Namely: get_proc_ptr_comp calls first gfc_conv_variable for 'x' but that ends up at: else if (!sym->attr.temporary && sym->attr.flavor == FL_PROCEDURE && se->expr != current_function_decl) { if (!sym->attr.dummy && !sym->attr.proc_pointer) { gcc_assert (TREE_CODE (se->expr) == FUNCTION_DECL); as 'x' as the FL_PROCEDURE – but it not a procedure but just a CLASS variable.