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

            Bug ID: 89943
           Summary: Submodule functions are not allowed to have C binding
           Product: gcc
           Version: 8.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aluaces at udc dot es
  Target Milestone: ---

The submodule

module Foo_mod

    interface
    module subroutine runFoo4C(ndim) bind(C, name="runFoo")
        use, intrinsic :: iso_c_binding
        implicit none
        integer(c_int32_t) , intent(in) :: ndim
    end subroutine runFoo4C
    end interface
contains
end module Foo_mod

submodule (Foo_mod) Foo_smod

contains

    module subroutine runFoo4C(ndim) bind(C, name="runFoo")

        use, intrinsic :: iso_c_binding
        implicit none
        integer(c_int32_t) , intent(in) :: ndim

    end subroutine runFoo4C

end submodule Foo_smod

is giving the following error:

BIND(C) attribute at (1) can only be used for variables or common blocks

That is, so far we cannot have a BIND(C) procedure in the interface of a
submodule.

The discussion at
https://stackoverflow.com/questions/54857067/fortran-c-interoperable-submodule-procedure-with-bindc-reports-error-when-comp
says it should be legal, so it seems it is a bug in gfortran.

Reply via email to