(j3.2006) Multiple interfaces for same procedure

Van Snyder Van.Snyder
Tue Mar 8 18:55:13 EST 2011


Offhand, I'd say the examples are not standard conforming.  See
[10-007r1:281:37-38].

Hmmm, it says "... if THE interface is accessed by use association...."
But this is in the context of "more than one," so what does "THE" mean?

I also wonder about the submodule case.  Does a separate module
procedure, with an interface body in the module and its definition in a
submodule, introduced by, e.g., a MODULE SUBROUTINE... statement, have
two explicit specific interfaces?  The list in 16.5.1.4 doesn't include
"interface body," so the explicit specific interface specified by the
MODULE SUBROUTINE definition doesn't "cover up" the one declared by the
interface body and gotten into the submodule by host association.  Even
if that were the case, we now allow the interface body and subprogram to
be in the same module.

On Tue, 2011-03-08 at 12:53 -0800, Bill Long wrote:
> Is it allowed to have two interfaces for the same procedure accessible
> (excluding the submodule case)? For example:
> 
> module modu
>     interface
>        subroutine sub(x)
>          real x
>        end subroutine sub
>     end interface
> end module modu
> 
> subroutine sub(x)
>     use modu
>     real x
>     x = 2.3
> end subroutine sub
> 
> This gives no error with 3 compilers, but one compiler complains about
> the multiple definition of "sub".
> 
> Somewhat more concerning is this example:
> 
> module modu
>     interface
>        recursive subroutine sub(x)
>          integer x
>        end subroutine sub
>     end interface
> end module modu
> 
> recursive subroutine sub(x)
>     use modu
>     real x
>     x = 2.3
> end subroutine sub
> 
> In this case, the two accessible interfaces for SUB are actually
> *different*.  Even so, the same 3 compilers gave no error, and the
> fourth one issued the same error as for the first example.
> 
> Is either of these examples legal?
> 
> Cheers,
> Bill
> 
> 




More information about the J3 mailing list