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

Jim Xia jimxia
Fri Jan 18 14:45:52 EST 2008


The program is standard conforming as I understand it.  A procedure with 
BIND attribute must have an explicit interface, see [258:6].  Without 
explicit interface, the main program has no idea that you want the 
subroutine s to be a C procedure.  That's why you'll get both s and t as 
valid procedure names in your program.

Thanks,

Jim Xia

XL Fortran Compiler Testing
IBM Toronto Lab at 8200 Warden Ave.
Phone (905) 413-3444  Tie-line 313-3444
D2/NAH/8200 /MKM



Michael Ingrassia <michaeli at ranma.sfbay.sun.com> 
Sent by: j3-bounces at j3-fortran.org
01/18/2008 02:35 PM
Please respond to
fortran standards email list for J3 <j3 at j3-fortran.org>


To
j3 at j3-fortran.org
cc

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






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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://j3-fortran.org/pipermail/j3/attachments/20080118/9943c3bf/attachment.html 



More information about the J3 mailing list