From owner-sc22wg5@open-std.org  Sat Nov 29 21:50:11 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 B54FDC178D9; Sat, 29 Nov 2008 21:50:11 +0100 (CET)
X-Original-To: sc22wg5@open-std.org
Delivered-To: sc22wg5@open-std.org
X-Greylist: delayed 951 seconds by postgrey-1.18 at www2.open-std.org; Sat, 29 Nov 2008 21:50:10 CET
Received: from mailout04.t-online.de (mailout04.t-online.de [194.25.134.18])
	by www2.open-std.org (Postfix) with ESMTP id E94EBC178D6
	for <sc22wg5@open-std.org>; Sat, 29 Nov 2008 21:50:10 +0100 (CET)
Received: from fwd11.aul.t-online.de 
	by mailout04.sul.t-online.de with smtp 
	id 1L6WW9-00061e-00; Sat, 29 Nov 2008 21:34:17 +0100
Received: from [192.168.2.100] (EG7yEuZcrhLzgDvojiGfHEmwzjs5lrWUPr8JwW5UUHKmBeghaUhWIbVwjR0XYgGgg0@[84.154.94.203]) by fwd11.aul.t-online.de
	with esmtp id 1L6WVx-0c2nWi0; Sat, 29 Nov 2008 21:34:05 +0100
Message-ID: <4931A73C.1030200@lrz.de>
Date: Sat, 29 Nov 2008 21:34:04 +0100
From: bader-reinhold@t-online.de (Reinhold Bader)
Reply-To: Bader@lrz.de
User-Agent: Thunderbird 2.0.0.18 (X11/20081112)
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
Content-Transfer-Encoding: 7bit
X-ID: EG7yEuZcrhLzgDvojiGfHEmwzjs5lrWUPr8JwW5UUHKmBeghaUhWIbVwjR0XYgGgg0
X-TOI-MSGID: de3c2a8c-5cc6-48c1-9b7e-56c1cb5efb45
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

