From lrr@cray.com  Fri Feb  2 22:17:27 1996
Received: from timbuk.cray.com (root@timbuk.cray.com [128.162.19.7]) by dkuug.dk (8.6.12/8.6.12) with ESMTP id WAA01499 for <SC22WG5@dkuug.dk>; Fri, 2 Feb 1996 22:17:15 +0100
Received: from ironwood.cray.com (root@ironwood-fddi.cray.com [128.162.21.36]) by timbuk.cray.com (8.6.12/CRI-gate-8-2.11) with ESMTP id PAA15065 for <SC22WG5@dkuug.dk>; Fri, 2 Feb 1996 15:17:00 -0600
Received: from poplar409 (lrr@poplar409 [128.162.149.9]) by ironwood.cray.com (8.6.12/CRI-ccm_serv-8-2.8) with SMTP id PAA26462 for <SC22WG5@dkuug.dk>; Fri, 2 Feb 1996 15:16:57 -0600
From: Larry Rolison <lrr@cray.com>
Received: by poplar409 (5.x/btd-b3)
          id AA17307; Fri, 2 Feb 1996 15:16:55 -0600
Message-Id: <9602022116.AA17307@poplar409>
Subject: Erik Kruyt's interface question
To: SC22WG5@dkuug.dk
Date: Fri, 2 Feb 1996 15:16:54 -0600 (CST)
X-Mailer: ELM [version 2.4 PL24-CRI-b]
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Sorry that I'm sending this to everyone but I dug through the messages 
from Erik and could not find an address just for him.  But others might
be interested in my response to his question anyway.

Erik asked:

4. What is wrong with the following code (the compilers I tried did not accept
   it):

        subroutine sub(dum1, dum2)
!subroutine with two dummy procedure arguments
        interface
          subroutine dum1(dum)
            interface
              real function dum(arg)
                real, intent(in) :: arg
              end function dum
            end interface
          end subroutine dum1
          real function dum2(arg)
            real, intent(in) :: arg
          end function dum2
        end interface
        call dum1(dum2(1.))
        end subroutine sub

In fact, NONE of the compilers I tried it with accepted it.  And they all
rejected it for the same reason (but different wording):

Our compiler said:

%>$g90 -en -m0 kruyt.f

        call dum1(dum2(1.))
                  ^         
cf90-502 cft90: ERROR SUB, File = kruyt.f, Line = 15, Column = 19 
  This actual argument is not a program unit.  Dummy argument "DUM" is a dummy procedure.


Nag said:

%>nagc kruyt.f
Error: Expected procedure for argument DUM (no. 1) of DUM1 at line 15
[f90 error termination]


And EPC said:

%>epc kruyt.f
EPC Fortran-90 Version 1.0.1 Sparc:200194:105916
Copyright (c) 1993,1994 EPCL. All Rights Reserved.
kruyt.f
   external subroutine SUB
        call dum1(dum2(1.))
             ^
Error 260 at (15:kruyt.f) : This subroutine has the wrong number of arguments or arguments with the wrong name, type or rank



The problem with your program, Erik, is that you are passing a VALUE to 
DUM1, not a procedure name.  Look at the call to DUM1 again in our message
just above.  You are passing DUM2(1.).  Since this dummy argument is an
expression, the expression is evaluated, which of course causes DUM2 to 
be executed and a real result returned.  Thus, you are trying to pass a real
value to DUM1 rather than a procedure name.  To get this right, you need to
change it to      call dum1(dum2)   and then from within DUM1 call the 
dummy argument corresponding to DUM2 passing the value "1.".
 
------------------------------------------------------------------------------
Larry Rolison          lrr@cray.com
Cray Research, Inc.
655F Lone Oak Drive
Eagan, MN  55121
------------------------------------------------------------------------------
