--- Comment #2 from Tobias Burnus <burnus at gcc dot> ---
Created attachment 47407
Lightly tested patch

(In reply to Martin Liška from comment #1)
> Confirmed, started with r218068, it was rejected before the revision.
Which is from 2014 - 5 years ago … I am not sure whether it then really makes
sense to add someone as CC :-)

The problem is that gfc_finish_var_decl's
690       else if (sym->module && !sym->attr.result && !sym->attr.dummy)
is evaluated as true for the 'max' function as sym->module is "(intrinsic)" but
it is still marked as sym->attr.flavor == FL_VARIABLE and sym->attr.function ==

Or in other words, gfc_intrinsic_func_interface does:

  expr->value.function.isym = specific;
  if (!expr->symtree->n.sym->module)
    gfc_intrinsic_symbol (expr->symtree->n.sym);

which updates expr->value.function and sets expr->symtree->n.sym to intrinsic,
but otherwise,  expr->symtree->n.sym is still FL_UNKNOWN and attr.function = 0.

As this is now fine, resolve_unknown_f returns and nothing happens later. (The
expr type is expr->type == EXPR_CONST).

Something like the following seems to work. But one really needs to do
something like that for all gfc_intrinsic_func_interface calls, e.g. by adding
such a resolve call to gfc_intrinsic_func_interface itself.

Reply via email to