From owner-sc22wg5@open-std.org  Tue Dec  9 19:46:56 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 00D5DCA343D; Tue,  9 Dec 2008 19:46:56 +0100 (CET)
X-Original-To: sc22wg5@open-std.org
Delivered-To: sc22wg5@open-std.org
Received: from ppsw-6.csi.cam.ac.uk (ppsw-6.csi.cam.ac.uk [131.111.8.136])
	by www2.open-std.org (Postfix) with ESMTP id 26B9DCA3439
	for <sc22wg5@open-std.org>; Tue,  9 Dec 2008 19:46:54 +0100 (CET)
X-Cam-AntiVirus: no malware found
X-Cam-SpamDetails: not scanned
X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/
Received: from hermes-1.csi.cam.ac.uk ([131.111.8.51]:57313)
	by ppsw-6.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.156]:25)
	with esmtpa (EXTERNAL:nmm1) id 1LA7bh-0007ZS-MJ (Exim 4.70) for sc22wg5@open-std.org
	(return-path <nmm1@hermes.cam.ac.uk>); Tue, 09 Dec 2008 18:46:53 +0000
Received: from prayer by hermes-1.csi.cam.ac.uk (hermes.cam.ac.uk)
	with local (PRAYER:nmm1) id 1LA7bh-0004b9-T5 (Exim 4.67) for sc22wg5@open-std.org
	(return-path <nmm1@hermes.cam.ac.uk>); Tue, 09 Dec 2008 18:46:53 +0000
Received: from [83.67.89.123] by webmail.hermes.cam.ac.uk
	with HTTP (Prayer-1.3.1); 09 Dec 2008 18:46:53 +0000
Date: 09 Dec 2008 18:46:53 +0000
From: "N.M. Maclaren" <nmm1@cam.ac.uk>
To: WG5 <sc22wg5@open-std.org>
Subject: Re: [ukfortran] (SC22WG5.3791) (j3.2006) N1761, TYPE(*),	BIND(C) and arrays
Message-ID: <Prayer.1.3.1.0812091846530.16063@hermes-1.csi.cam.ac.uk>
In-Reply-To: <20081209172327.D05AFC178D6@www2.open-std.org>
References: <20081127193527.EF00DC178D9@www2.open-std.org>
 <20081202130345.82E16C178E1@www2.open-std.org>
 <20081209122438.AE57DCA3439@www2.open-std.org>
 <20081209172327.D05AFC178D6@www2.open-std.org>
X-Mailer: Prayer v1.3.1
Mime-Version: 1.0
Content-Type: text/plain; format=flowed; charset=ISO-8859-1
Sender: owner-sc22wg5@open-std.org
Precedence: bulk

On Dec 9 2008, Bill Long wrote:
>
>> This is something that I subconsciously realised when reading N1761,
>> but only formulated what it was fairly recently.  Fortran does not have
>> the concept of a called procedure knowing anything about the properties
>> of its actual arguments (i.e. the objects and expressions in the calling
>> procedure).  The SOLE information available to a called procedure about
>> its arguments are in its OWN declaration (i.e. the properties of its
>> dummy arguments).
>
>That paragraph is so completely wrong that I'm just dumbfounded.   Do 
>you mean that if I inquire about the allocation status of a dummy 
>variable at the beginning of a subroutine, I get no information about 
>the allocation status of the corresponding actual argument?  Or the 
>pointer association status of a pointer? Or the extents of an 
>assumed-shape array?  None of this information is explicit in the 
>declaration of the dummy argument.  Of course, these are exactly the 
>cases the TR is intended to address.   No wonder you are finding it so 
>hard to understand.

No, I do not mean precisely what you say, but I do mean something very
close to it.  I used the word 'properties' because I was referring to
states that Fortran does not have a term for.  Let's summarise the
'properties' I was NOT referring to:

    1) Allocation and pointer status.  Yes, those transfer down fairly
reliably - they weren't the properties I was referring to - but it isn't
clear how N1761 handles such things with INTENT(OUT).

    2) Attributes.  The called procedure has no information about the
attributes of the actual arguments, where they are allowed to differ from
the attributes of the dummy arguments.

But let's skip both of those, because N1761 doesn't rely on them (much).

What I was referring to were the properties of array shapes/sections and
whether array arguments are expressions (and, if so, what kind).  Yes, N1761
is intended to address these, but it fails to do so.  In the following:

    REAL :: x(10)
    CALL Fred(x(m:n:k))

x(m:n:k) is a section of an explicit-size array, NOT an assumed-shape array.
2.1.3.4 makes it clear that the terms assumed-shape and assumed-size refer
only to dummy arguments, which x(m:n:k) most definitely isn't.

In order to make N1761 meaningful, you need to specify what the term
"assumed-shape" means for an argument passed as DIMENSION(..).  If you look
at the example program, you will see that it introduces some very nasty
questions about that.  If I wasn't in such a hurry, I am sure that I could
think up some much more evil ones ....

In other words, N1761 has started to use the term "assumed-shape" to refer
to actual arguments, without specifying what it means when used like that.


Alternatively, please ignore all of my commentary in that posting, and that
I have included above, and just answer the questions on that program.  Just
HOW is each of those arguments passed?



Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QH, England.
Email:  nmm1@cam.ac.uk
Tel.:  +44 1223 334761    Fax:  +44 1223 334679




