Hello,
Le 19/09/2022 à 22:17, Harald Anlauf via Fortran a écrit :
Dear all,
the following patch was submitted by Jose but never reviewed:
https://gcc.gnu.org/pipermail/fortran/2021-April/055946.html
Before, we didn't set function attributes properly when
passing polymorphic pointers, which could lead to
mis-optimization.
The patch is technically fine and regtests ok, although it
can be shortened slightly, which makes it more readable,
see attached.
When testing the suggested testcase I found that it was
accepted (and working fine) with NAG, but it was rejected
by both Intel and Cray. This troubled me, but I think
it is standard conforming (F2018:15.5.2.7), while the
error messages issued by Intel
PR100132.f90(61): error #8300: If a dummy argument is allocatable or a pointer,
and the dummy or its associated actual argument is polymorphic, both dummy and
actual must be polymorphic with the same declared type or both must be
unlimited polymorphic. [S]
call set(s)
-------------^
and a similar one by Cray, suggest that they refer to
F2018:15.5.2.5, which IMHO does not apply here.
(The text in the error message seems very related to
the reasoning in Note 1 of that subsection).
I'd like to hear (read: read) a second opinion on that.
I think you are correct.
If the dummy wasn't INTENT(IN) the actual argument would have to be a
pointer, and then 15.5.2.5 would apply, but it's not the case here.
With INTENT(IN) the reasons for the constraints from Note 1 don't apply.
I think you can go ahead.