https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99651
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2021-03-18
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
That's for matching 'NULL()' in:
CHAR_STAR_NULL = CHAR_STAR(NULL())
The problem is that during matching we end up
in gfc_match_rvalue for:
/* Give up, assume we have a function. */
e->expr_type = EXPR_FUNCTION;
if (!sym->attr.function
&& !gfc_add_function (&sym->attr, sym->name, NULL))
which then also set:
if (attr->flavor != FL_PROCEDURE
&& !gfc_add_flavor (attr, FL_PROCEDURE, name, where))
return false;
attr->function = 1
And later then:
resolve_function → resolve_unknown_f → gfc_intrinsic_func_interface
the latter than has:
if (sym->attr.flavor == FL_UNKNOWN)
{
sym->attr.function = 1;
sym->attr.intrinsic = 1;
sym->attr.flavor = FL_PROCEDURE;
}
Thus, at the end intrinsic is not set in the module.
For the next use, we run into the following in gfc_match_null:
if (sym->attr.proc != PROC_INTRINSIC
&& !(sym->attr.use_assoc && sym->attr.intrinsic)
&& (!gfc_add_procedure(&sym->attr, PROC_INTRINSIC, sym->name, NULL)
|| !gfc_add_function (&sym->attr, sym->name, NULL)))
return MATCH_ERROR;
Here, we have:
- PROC_UNKNOWN
- sym->attr.intrinsic == 0
- gfc_add_procedure
→ this calls 'check_used' → which fails due to attr->use_assoc != 0.