[J3] dumb question about module use not inheriting into interfaces

Jeff Hammond jehammond at nvidia.com
Fri Aug 26 10:04:09 UTC 2022


I observe that the following code fails when the line with “REQUIRED” in it is commented-out, but I do not understand it.

Why does the use inclusion of ISO_Fortran_env propagate into the contained subroutine but not the interface block?

It is mildly annoying to have to add a use line to every single interface, when it is used in the module already, but I assume there is some good reason for this.

Thanks,

Jeff

module confused
    use, intrinsic :: ISO_Fortran_env

    interface
        subroutine foo(buffer) bind(C,name="foo")
            use, intrinsic :: ISO_Fortran_env ! REQUIRED
            implicit none
            real(kind=REAL64), dimension(*) :: buffer
        end subroutine foo
    end interface

    contains

        subroutine bar(buffer) bind(C,name="bar")
            implicit none
            real(kind=REAL64), dimension(*) :: buffer
        end subroutine bar

end module confused
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20220826/6ca29338/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vHLXMgthoPseBL8O.png
Type: image/png
Size: 5192 bytes
Desc: vHLXMgthoPseBL8O.png
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20220826/6ca29338/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: C0W9i4sklNBx3E9p.png
Type: image/png
Size: 3577 bytes
Desc: C0W9i4sklNBx3E9p.png
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20220826/6ca29338/attachment-0001.png>


More information about the J3 mailing list