(j3.2006) binding labels and global identifiers

Robert Corbett robert.corbett
Tue Jun 14 06:28:09 EDT 2011


One of Oracle's other engineers working on Fortran raised
a question regarding conflicting binding labels and global
identifiers (see Clause 16.2 of 10-007r1).  He pointed out
that many Fortran implementations, including Oracle's,
construct the linker name for an external procedure or
common block by adding a low line to the end of the global
name of the procedure or common block.  Consider the
following program:

      MODULE variables
        USE ISO_C_BINDING
        PRIVATE
        PUBLIC x
        REAL, BIND(C, NAME="subr_") :: x = 0.1
      END

      SUBROUTINE subr
        USE variables
        PRINT *, x
      END

      PROGRAM main
        CALL subr
      END

This program caused a problem for every implementation I
tried.  I was amused that it failed in a different way for
each implementation.  Nonetheless, the program does not
appear to violate the requirements set out in Clause 16.2.
The global identifier "subr" and the binding label "subr_"
are different according to the language of Clause 16.2.

Is the program presented above intended to be standard-
conforming?  Implementations could easily be made to handle
the program by using a different mapping of global names to
linker names.  Making such a change might break backward
compatibility.

Robert Corbett



More information about the J3 mailing list