(j3.2006) binding labels and global identifiers

Van Snyder Van.Snyder
Wed Jun 22 17:08:23 EDT 2011


On Wed, 2011-06-22 at 12:41 -0700, Bill Long wrote:
> In any case, this is a candidate for an Interp.

The interp question would have to be of the form "were you guys
serious?"  Or maybe "Wouldn't it be OK to have more global identifiers
that aren't specified in 16.2p1?"

16.2p1 is pretty clear:

The global identifier of an external procedure with no binding label
[that is, with no BIND attribute] is the name of the procedure.  It goes
on to say that a binding label is a global identifier.  One might ask
for clarification whether the name of the procedure that has a binding
label is also a global identifier, but it's not in the list in 16.2p1,
so I'd be inclined to say "no" to both questions.

So, in the interface block from a few days ago

interface
  subroutine subr () bind(C,name='subr_')
    ...
  end subroutine subr
end interface

"subr" is not a global identifier.  This was already the subject of an
interp.  If in some other scoping unit one has written

interface
  subroutine subr () bind(C,name='foo_')
    ...
  end subroutine subr
end interface

it should refer to a different procedure from the previous one, and not
fall afoul of of the rule prohibiting different entities from having the
same global identifier.

If the processor in addition invents "subr_" or "_subr_" or "subr__" or
"_subr__" because the procedure name is "subr" and makes that a global
identifier, that appears to me not to be standard conforming.  The
processor might instead call that a binding label, but 15.5.2p1-2 are
quite clear what a binding label is, and these aren't in the list.

15.5.2 is also quite clear that the binding label of a procedure that
has BIND(C) without name= is "the same as the name of the procedure
using lower case letters."  Therefore, in

interface
  subroutine subr () bind(C)
    ...
  end subroutine subr
end interface

the binding label is "subr".  There's nothing anywhere that says that
something the processor derives from the procedure name is a global
identifier.

Further, if one has written

interface
  subroutine foo () bind(C,name="subr_")
    ...
  end subroutine foo
  subroutine subr ()
    ...
  end subroutine subr
end interface

16.2p2 again pretty clearly establishes a perfectly good interpretation.
The global identifier of "foo" is "subr_", and the global identifier of
"subr" is "subr", not "subr_" or "_subr_" or "subr__" or "_subr__".

Maybe 15.5.2p1 should be clarified that the binding label is the name by
which the procedure is known, both to the Fortran processor and to the
companion processor, since if a procedure has a binding label its name
is not a global identifier.  That is, replace "companion processor" by
"processor and its companion processors" at [437:7], and at [436:3] for
the same reasons.

If one has written

interface
  subroutine foo () bind(C,name="Subr")
    ...
  end subroutine foo
  subroutine subr ()
    ...
  end subroutine subr
end interface

there might be a question.  Is the global identifier of "subr" without
regard to case?





More information about the J3 mailing list