Hi Tobias,

Please go ahead and commit the patch. I think that your analysis is correct
about expr_null and that your patch is the best way to deal with the
problem.

Best regards

Paul


On Tue, 23 Mar 2021 at 17:54, Tobias Burnus <tob...@codesourcery.com> wrote:

> Hi Paul,
>
> On 23.03.21 18:34, Paul Richard Thomas wrote:
> > I took something of a detour in reviewing this patch. Although short,
> > understanding it is not straightforward!
>
> I concur – and as I wrote both in the patch email and in the PR, it is
> not straight forward which message is showing with which setting.
>
> Actually, I think there are many straight-forward ways to fix it
> "properly" but they tend to hide some nicer error messages in favour of
> a more generic one. Only by taking into account all the diagnostic and
> hidden/delayed diagnostic, the patch becomes complex. (-:
>
> > Your patch works as advertised and regtests OK (with the patch for
> > PR93660 on board as well). Is NULL the only case where this can happen?
>
> I am not sure whether any other code would profit form getting one of
> the attributes conditionally assigned in intrinsic.c.
>
> Otherwise, I think that's the only code which verifies like that it in
> such a way whether an intrinsic function was used. I think the reason
> that it does so is because 'null' is turned early during parsing into
> EXPR_NULL, which is not a function and, hence, bypasses some of the
> later checking code in resolve.c.
>
>
> > Just to aid my understanding, I tried:
> > diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
> >
> > --- a/gcc/fortran/primary.c
> > +++ b/gcc/fortran/primary.c
> > @@ -3922,6 +3922,9 @@ gfc_match_rvalue (gfc_expr **result)
> >        if (m == MATCH_NO)
> >         m = MATCH_YES;
> >
> > +      if (!strcmp (sym->name, "NULL") || !strcmp (sym->name, "null"))
> > +       sym->attr.intrinsic = 1;
> > +
> >        break;
> >
> >      generic_function:
> >
> > which also works and regtests OK. (I couldn't remember whether
> > sym->name is upper or lower case at this stage.)
>
> Should be always lowercase, I think. But I am also not sure that your
> aid-understanding patch will work correctly with 'external null' or a
> use-/host-associated/interface 'null' procedure or some array variable.
> Inside intrinsic.c, we are at least sure that we did get an intrinsic
> function after having passed all intrinsic checks.
>
> Tobias
>
> -----------------
> Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München
> Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank
> Thürauf
>


-- 
"If you can't explain it simply, you don't understand it well enough" -
Albert Einstein

Reply via email to