Hello Thomas, hi all,
On 1/16/20 11:34 PM, Thomas Koenig wrote:
Anyway, the fix is rather straightforward. We cannot have a reference
on a function. If this slipped through on parsing, let's issue the
error during resolution.
Regression-tested. OK for trunk?
I think I am fine with the check itself – but …
+ if (expr->ref)
+ {
+ gfc_error ("Function call can not contain a reference at %L",
I have issues with the wording of the error message.
First, when reading the error message without context, I thought it is
about something regarding the arguments ("contain") or maybe the
reference of a function iself.
It is clear that we do not want to have anything after the
function-reference (→R1521). And we do lack a good wording for that what
one can (but shan't) put after the function-reference as it can be quite
a lot (cf. →R901): a following '%' to attempt to create a
structure-component or complex-part-component access or "(" to get a
substring or array-element/section access or '[' to get something coindexed.
Not that I like the wording in particular, but we use quite often
"Unexpected junk" in the parser. Hence: "Unexpected junk after function
reference at %L" would work.
Or maybe clearer:
char ref_char = '%'; // REF_INQUIRY or REF_COMPONENT
if (expr->ref->type == REF_ARRAY || expr->ref->type == REF_SUBSTRING)
ref_char = ((expr->ref->type == REF_ARRAY && !expr->ref->u.ar.dimen)
'[' : '(';
… ("Unexpected %qc after function reference at %L", ref_char, …);
Although, I am not sure the '[' (coindex) can occur.
Cheers,
Tobias