(j3.2006) Binding label and bind(c) procedure name scopes

Daniel C Chen cdchen
Tue May 26 10:42:31 EDT 2015


Bill said:
<<<
....
The argument for allowing this, based on 15-007,  is that the ?entity of
the program? in the first interface is the external subroutine that has
?csub" as its binding label. Another entity of the program is  the external
subroutine with the binding label ?sub?.  Since the same entity cannot have
two different binding labels (your quote above), these two external
subroutines are necessarily different.
>>>

Will this argument make Case 3 illegal?

Because if we treat external subroutine 's' in 'sub1' as a different entity
from 's' in 'sub2', it seems it violates [473:27-28]
"The global identifier of an entity shall not be the same as the global
identifier of any other entity. Furthermore, a binding label shall not be
the same as the global identifier of any other global entity..."

I also think we should allow Case 2.

Is changing the following sentence in the standard what we need?

""An entity of the program shall not be identified by more than one binding
label.""
To
"An entity of the scope unit shall not be identified by more than one
binding label."


Thanks,

Daniel

XL Fortran Development - IBM Toronto Software Lab
Phone: 905-413-3056
Tie: 969-3056
Email: cdchen at ca.ibm.com
http://www.ibm.com/software/awdtools/fortran/xlfortran



From:	Bill Long <longb at cray.com>
To:	fortran standards email list for J3 <j3 at mailman.j3-fortran.org>
Date:	05/26/2015 08:53
Subject:	Re: (j3.2006) Binding label and bind(c) procedure name scopes
Sent by:	j3-bounces at mailman.j3-fortran.org




On May 26, 2015, at 1:23 AM, Malcolm Cohen <malcolm at nag-j.co.jp> wrote:


I agree that Cases 1 and 3 are OK.

> <<<
> Case 2:
>
> Module m
> Contains
>  Subroutine sub1()
>    Interface
>      Subroutine s() Bind(C, name="csub")
>      End
>    End interface
>  End
>  Subroutine sub2()
>    Interface
>      Subroutine s() Bind(C, name="sub")
>      End
>    End interface
>  End
> End module
>
>
> Is this code legal? Again, it seems fine to me, but it seems disallowed
by the
> standard at [474:26]
> "An entity of the program shall not be identified by more than one
binding
> label."
>>>>
>
> Yes, this is invalid and rejected by some existing compilers.  This has
been
> discussed in the past.

And other compilers will accept it.  I thought we already changed the
standard to allow this.  There was certainly a desire by some that this be
allowed.  The argument for allowing this, based on 15-007,  is that the
?entity of the program? in the first interface is the external subroutine
that has ?csub" as its binding label. Another entity of the program is  the
external subroutine with the binding label ?sub?.  Since the same entity
cannot have two different binding labels (your quote above), these two
external subroutines are necessarily different.

Inside sub1() the statement  CALL S ( ) results in a call to csub.
Similarly, in sub2( ), CALL S( ) results in a call to sub.    In 16.2, the
name of an  "external procedure with no binding label? is a global
identifier.  In 16.3 the names of 		 "external procedures that have
binding labels? are local identifiers.  So, in both sub1 sub2, the names S
are local identifiers.  Since they are in  different scopes, there is no
conflict with the standard, and no ambiguity in the implementation.

Cheers,
Bill

>
> If we want to allow this we are going to have to reword 16.2p1 much much
more
> carefully; for a start, so that external procedures with binding labels
don't
> appear twice in the list, to avoid confusion.  I am sympathetic to such a

> request.

Bill Long
longb at cray.com
Fortran Technical Support  &                                  voice:
651-605-9024
Bioinformatics Software Development                     fax:  651-605-9142
Cray Inc./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101


_______________________________________________
J3 mailing list
J3 at mailman.j3-fortran.org
http://mailman.j3-fortran.org/mailman/listinfo/j3

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.j3-fortran.org/pipermail/j3/attachments/20150526/7e6fa07e/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
Url : http://mailman.j3-fortran.org/pipermail/j3/attachments/20150526/7e6fa07e/attachment.gif 



More information about the J3 mailing list