(j3.2006) calling a Fortran subroutine with BIND attribute--standard conforming or no?

Bill Long longb
Fri Jan 18 14:50:33 EST 2008

The second two lines of your program text are a separate program unit, 
namely the main program.  There is a reference to a subroutine that has 
the bind attribute.  In that case an interface in the calling program 
unit is required.  See [258:6].


Michael Ingrassia wrote:
> I'm having trouble finding some language I expected to be in Fortran 2003.
> Consider the program:
> 	subroutine s() bind(c,name='t')
> 	end subroutine s
> 	call s()
> 	end
> I think that this program is not standard conforming.  Oh, it will run ok
> on a processor that routinely translates subroutines named s into
> routines with linker name t, but I doubt such processors exist!
> Mostly I expect it will try to call a routine with linker name derived from "s"
> (say, s_) and fail because user has supplied only a subroutine with linker
> name t.
> But I can't find any language in the standard that says this program
> isn't standard conforming.  We seem to be defining a Fortran subroutine named
> s with some extra attributes , and then calling that subroutine.
> The extra attribute is the name by which the subroutine is known to the
> companion processor, which is utterly irrelevant in this all-Fortran run.
> Am I right that the name of the subroutine defined in lines 1-2 is "s" ?
> Doesn't C1223 say that the procedure-designator in the CALL statement
> shall be the name of the procedure, not the binding label ?
> Where is there language saying that if we call a subroutine with an
> unexpected binding label, an interface supplying the binding label 
> must be in force?
> 	--Michael I.
> _______________________________________________
> J3 mailing list
> J3 at j3-fortran.org
> http://j3-fortran.org/mailman/listinfo/j3

Bill Long                                   longb at cray.com
Fortran Technical Support    &              voice: 651-605-9024
Bioinformatics Software Development         fax:   651-605-9142
Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120


More information about the J3 mailing list