Hi Jerry!
Am 31.05.26 um 5:46 AM schrieb Jerry D:
The attached patch regression tested on x86_64.
Are you sure that the reference to F18:15.5.2.4 is correct?
I cannot find your quote there, at least not verbosely.
Furthermore, can you provide a testcase where the new error message
will be tested?
Thanks,
Harald
Note, this is one of several mentioned in PR125515. I will be submitting
those as a patch series a bit later.
OK for mainline and then backport to 16?
Regards,
Jerry
---
fortran: fix wrong generic resolution when actual argument is
a procedure pointer
When a generic interface has two specific procedures -- one with a
procedure-pointer dummy and one with a data-object (e.g. REAL) dummy --
gfortran incorrectly resolved calls where the actual argument was a
procedure pointer to the data-object specific, resulting in the pointer
address being interpreted as a numeric value (wrong code).
The root cause was a missing check in gfc_compare_actual_formal: the
two existing checks guard the case where the formal is a proc_pointer
or FL_PROCEDURE but the actual is not; however the reverse direction
(actual is a proc_pointer but formal is a plain data object) was not
checked. F18:15.5.2.4 forbids this pairing.
Assisted by: Claude Sonnet 4.6
PR fortran/125481
gcc/fortran/ChangeLog:
* interface.cc (gfc_compare_actual_formal): Add missing check that
rejects a procedure-pointer actual argument corresponding to a
data-object dummy argument (F18:15.5.2.4). Restrict to
EXPR_VARIABLE to avoid false positives on calls through procedure
pointer components.
gcc/testsuite/ChangeLog:
* gfortran.dg/generic_37.f90: New test.
---