From owner-sc22wg5@open-std.org  Sat Nov 29 22:07:06 2008
Return-Path: <owner-sc22wg5@open-std.org>
X-Original-To: sc22wg5-dom7
Delivered-To: sc22wg5-dom7@www2.open-std.org
Received: by www2.open-std.org (Postfix, from userid 521)
	id 5836BC178D9; Sat, 29 Nov 2008 22:07:06 +0100 (CET)
X-Original-To: sc22wg5@open-std.org
Delivered-To: sc22wg5@open-std.org
X-Greylist: delayed 900 seconds by postgrey-1.18 at www2.open-std.org; Sat, 29 Nov 2008 22:07:05 CET
Received: from mailrelay2.lrz-muenchen.de (mailrelay2.lrz-muenchen.de [129.187.254.102])
	by www2.open-std.org (Postfix) with ESMTP id 8F371C178D6
	for <sc22wg5@open-std.org>; Sat, 29 Nov 2008 22:07:05 +0100 (CET)
Received: from [129.187.48.207] ([129.187.48.207] [129.187.48.207]) by mailout.lrz-muenchen.de with ESMTP; Sat, 29 Nov 2008 21:51:54 +0100
Message-Id: <4931AB69.7070007@lrz.de>
Date: Sat, 29 Nov 2008 21:51:53 +0100
From: Reinhold Bader <Reinhold.Bader@lrz.de>
Reply-To: Reinhold.Bader@lrz.de
User-Agent: Thunderbird 2.0.0.18 (Windows/20081105)
MIME-Version: 1.0
To: fortran standards email list for J3 <j3@j3-fortran.org>
Cc: WG5 <sc22wg5@open-std.org>,
	Rolf Rabenseifner <rabenseifner@hlrs.de>
Subject: Comment on N1761
References: <20081127195627.3CEA7C178D6@www2.open-std.org>
In-Reply-To: <20081127195627.3CEA7C178D6@www2.open-std.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Sender: owner-sc22wg5@open-std.org
Precedence: bulk

Hello,

The TR 29113 draft contains the following example code:

interface MPI_send
    subroutine MPI_send_old (buffer, n) bind(c,name="MPI_send")
       type(*), dimension(*) :: buffer ! Passed by simple address
       integer(c_int),value :: n
    end subroutine
    subroutine MPI_send_new (buffer) bind(c,name="MPI_send_new")
       type(*), dimension(..), contiguous :: buffer
          ! Passed by descriptor including the shape and type
    end subroutine
end interface

real :: x(100), y(10,10)

! These will invoke MPI_send_old
call MPI_send(x,size(x)) ! Passed by address
call MPI_send(y,size(y)) ! Sequence association 
<----non-conforming?
call MPI_send(y(:,1),size(y,dim=1)) ! Pass first column of y
call MPI_send(y(1,5),size(y,dim=1)) ! Pass fifth column of y

! These will invoke MPI_send_new
call MPI_send(x) ! Pass a rank-1 descriptor
call MPI_send(y) ! Pass a rank-0 descriptor 
<---Typo? ("rank-2")
call MPI_send(y(:,1)) ! Passed by descriptor without copy
call MPI_send(y(1,5)) ! Illegal: No sequence association


In my opinion, the marked line would be non-conforming even under the
additional rules specified by TR29113, since it contravenes p290, para 13
of the F2008 draft standard 08-007r2, which disallows matching of actual
arguments of arbitrary ranks to the assumed size dummy of rank one *for
a generic interface*.

If my critique is correct, there are the following choices:

* Give up having a generic interface, or use the assumed size only
   for 1-d arrays. This would only require correcting the above example.
* Add an exception to the above-mentioned rule, applying for TYPE(*) 
arguments
   of assumed size. One possibility would be to allow a match with the 
specific
   with the largest rank smaller or equal to the actual arguments'; this 
might be
   reasonable not only for TYPE(*), but is probably not feasible due to
   backward incompatibility.

I'm also pointing out a typo in the use of the assumed rank part.

Best Regards

-- 
  Dr. Reinhold Bader

  Leibniz-Rechenzentrum, Abt. Hochleistungssysteme | Tel. +49 89 35831 8825
  Boltzmannstr. 1, 85748 Garching                  | Fax  +49 89 35831 9700

