[Bug fortran/66973] Incorrect resolution of generic interface with TYPE(C_PTR)

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Apr 4 07:56:59 GMT 2026


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66973

--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:64e03b96dfe593692d43bf5801f9b5103b71d085

commit r16-8455-g64e03b96dfe593692d43bf5801f9b5103b71d085
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Fri Apr 3 22:35:48 2026 +0200

    Fortran: fix resolution of generic interface with TYPE(C_PTR) [PR66973]

    When symbols from the intrinsic module ISO_C_BINDING were USEd indirectly,
    the resolution of generic interfaces with procedures having dummies with
    TYPE(C_PTR) or TYPE(C_FUNPTR) could fail when the actual argument was
    C_LOC() or C_FUNLOC().  Amend checking of actual versus formal procedure
    arguments to these cases.

            PR fortran/66973

    gcc/fortran/ChangeLog:

            * interface.cc (gfc_compare_actual_formal): Check that C_LOC and
            C_FUNLOC from ISO_C_BINDING as actual argument are passed to a
            dummy argument of matching type C_PTR/C_FUNPTR.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/generic_36-1.f90: New test.
            * gfortran.dg/generic_36-2.f90: New test.


More information about the Gcc-bugs mailing list