- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is unclear to me whether the indicated error about a binding specification being disallowed for internal procedures is correct. Does the Fortran standard really state as such? My quick read of the standard doesn't reveal any such thing and gfortran doesn't think so either.
module m implicit none contains subroutine foo() contains integer function bar() bind(C) bar = 0 end function bar end subroutine foo end module m
Compiling with Intel(R) Visual Fortran Compiler 16.0.1.146 [Intel(R) 64]... m.f90(11): error #8077: A proc-language-binding-spec shall not be specified for an internal procedure.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
An internal procedure, except when passed as an argument to another subroutine (in which case an interface may be needed in that subroutine), is not accessible from outside its host. Note 2.2 of the standard says "An internal procedure is local to its host in the sense that its name is accessible within the host scoping unit and all its other internal procedures but is not accessible elsewhere."
Therefore, NAME= and BIND= clauses serve no purpose in the heading of the internal procedure, although an implementation may provide for this non-required visibility as an extension. Perhaps that is what Gfortran does?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Fortran 2003 disallowed a proc-language-binding-spec for an internal procedure:
C1236 (R1225) A proc-language-binding-spec with a NAME= specifier shall not be specified in the function-stmt or subroutine-stmt of an interface body for an abstract interface or a dummy procedure.
C1237 (R1225) A proc-language-binding-spec shall not be specified for an internal procedure.
F2008 relaxes that, allowing a language binding spec for an internal procedure as long as it doesn't also specify NAME=
C1254 (R1229) A proc-language-binding-spec with a NAME= specifier shall not be specified in the function-stmt or subroutine-stmt of an internal procedure, or of an interface body for an abstract interface or a dummy procedure.
The next major release of Intel Fortran will support the F2008 language here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve Lionel (Intel) wrote:
Fortran 2003 disallowed a proc-language-binding-spec for an internal procedure:
C1236 (R1225) A proc-language-binding-spec with a NAME= specifier shall not be specified in the function-stmt or subroutine-stmt of an interface body for an abstract interface or a dummy procedure.
C1237 (R1225) A proc-language-binding-spec shall not be specified for an internal procedure.F2008 relaxes that, allowing a language binding spec for an internal procedure as long as it doesn't also specify NAME=
C1254 (R1229) A proc-language-binding-spec with a NAME= specifier shall not be specified in the function-stmt or subroutine-stmt of an internal procedure, or of an interface body for an abstract interface or a dummy procedure.
The next major release of Intel Fortran will support the F2008 language here.
Ok, thanks.
By the way, Steve, it does become very difficult to keep track of what's implemented and not e.g., all of Fortran 2015 features for enhanced interoperability are implemented but some from Fortran 2008 are not.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I do plan to restructure this article to be more in a chart form and also show when each feature became supported. You can also follow the tables updated every four months in ACM SIGPLAN Fortran Forum.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page