[Patch, fortran] PR98498 - Interp request: defined operators and unlimited polymorphic
Harald Anlauf
anlauf@gmx.de
Wed Nov 1 20:12:43 GMT 2023
Hi Paul,
Am 01.11.23 um 19:02 schrieb Paul Richard Thomas:
> The interpretation request came in a long time ago but I only just got
> around to implementing it.
>
> The updated text from the standard is in the comment. Now I am writing
> this, I think that I should perhaps use switch(op)/case rather than using
> if/else if and depending on the order of the gfc_intrinsic_op enum being
> maintained. Thoughts?
the logic is likely harder to parse with if/else than with
switch(op)/case. However, I do not think that the order of
the enum will ever be changed, as the module format relies
on that very order.
> The testcase runs fine with both mainline and nagfor. I think that
> compile-only with counts of star-eq and star_not should suffice.
I found other cases that are rejected even with your patch,
but which are accepted by nagfor. Example:
print *, ('a' == c)
Nagfor prints F at runtime as expected, as it correctly resolves
this to star_eq. Further examples can be easily constructed.
Can you have a look?
Thanks,
Harald
> Regtests with no regressions. OK for mainline?
>
> Paul
>
> Fortran: Defined operators with unlimited polymorphic args [PR98498]
>
> 2023-11-01 Paul Thomas <pault@gcc.gnu.org>
>
> gcc/fortran
> PR fortran/98498
> * interface.cc (upoly_ok): New function.
> (gfc_extend_expr): Use new function to ensure that defined
> operators using unlimited polymorphic formal arguments do not
> override their intrinsic uses.
>
> gcc/testsuite/
> PR fortran/98498
> * gfortran.dg/interface_50.f90: New test.
>
More information about the Fortran
mailing list