http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58658
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> --- (In reply to Tobias Burnus from comment #1) > Confirmed. Untested patch: Which of course doesn't work. What helps is the following patch (not regtested). I wonder why there is the unlimited check. - It looks completely bogus. --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -4693,7 +4693,6 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj, bool is_pointer; bool check_intentin; bool ptr_component; - bool unlimited; symbol_attribute attr; gfc_ref* ref; int i; @@ -4709,8 +4708,6 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj, sym = e->value.function.esym ? e->value.function.esym : e->symtree->n.sym; } - unlimited = e->ts.type == BT_CLASS && UNLIMITED_POLY (sym); - attr = gfc_expr_attr (e); if (!pointer && e->expr_type == EXPR_FUNCTION && attr.pointer) { @@ -4750,7 +4747,7 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj, /* Find out whether the expr is a pointer; this also means following component references to the last one. */ is_pointer = (attr.pointer || attr.proc_pointer); - if (pointer && !is_pointer && !unlimited) + if (pointer && !is_pointer) { if (context) gfc_error ("Non-POINTER in pointer association context (%s)"