Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29249 Discussions

Error #8077: A proc-language-binding-spec shall not be specified for an internal procedure. - Is it correct?

FortranFan
Honored Contributor III
1,188 Views

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.

 

0 Kudos
4 Replies
mecej4
Honored Contributor III
1,188 Views

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?

0 Kudos
Steven_L_Intel1
Employee
1,188 Views

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.

0 Kudos
FortranFan
Honored Contributor III
1,188 Views

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.  

0 Kudos
Steven_L_Intel1
Employee
1,188 Views

https://software.intel.com/en-us/articles/intel-fortran-compiler-support-for-fortran-language-standards/ ;

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.

0 Kudos
Reply