From owner-sc22wg5@open-std.org  Sun Feb  7 21:53:52 2010
Return-Path: <owner-sc22wg5@open-std.org>
X-Original-To: sc22wg5-dom8
Delivered-To: sc22wg5-dom8@www2.open-std.org
Received: by www2.open-std.org (Postfix, from userid 521)
	id 52F0CC3BA2A; Sun,  7 Feb 2010 21:53:52 +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; Sun, 07 Feb 2010 21:53:51 CET
Received: from mailrelay2.lrz-muenchen.de (mailrelay2.lrz-muenchen.de [129.187.254.102])
	by www2.open-std.org (Postfix) with ESMTP id C2E47C3BA29
	for <sc22wg5@open-std.org>; Sun,  7 Feb 2010 21:53:51 +0100 (CET)
Received: from [129.187.48.229] ([129.187.48.229] [129.187.48.229]) by mailout.lrz-muenchen.de with ESMTP; Sun, 7 Feb 2010 21:38:38 +0100
Message-Id: <4B6F24CD.80200@lrz.de>
Date: Sun, 07 Feb 2010 21:38:37 +0100
From: Reinhold Bader <Reinhold.Bader@lrz.de>
User-Agent: Thunderbird 2.0.0.21 (Windows/20090302)
MIME-Version: 1.0
To: "N.M. Maclaren" <nmm1@cam.ac.uk>
Cc: sc22wg5 <sc22wg5@open-std.org>
Subject: Re: (SC22WG5.4164) Please say this isn't allowed!
References: <20100206000326.EB642C3BA22@www2.open-std.org> <20100207193242.EDEE6C3BA07@www2.open-std.org>
In-Reply-To: <20100207193242.EDEE6C3BA07@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,

referring to the 2003 standard, I think this is illegal due to 12.4.1.2 
(p270,  20-22).:
"If the dummy argument has the TARGET attribute and the corresponding 
actual argument does not
have the TARGET attribute or is an array section with a vector 
subscript, any pointers associated with
the dummy argument become undefined when execution of the procedure 
completes."

Regards
Reinhold

N.M. Maclaren schrieb:
> While writing a paper on C interoperability, I was checking on Fortran's
> equivalents to some C facilities, and I cannot find anything that forbids
> this.  NAG objects to it, but Intel and Pathscale allow it - or, at 
> least,
> let it happen ....
>
> PROGRAM Main
>    REAL, POINTER, DIMENSION(:) :: p => NULL()
>    REAL :: x = 1.0, y = 2.0, z = 3.0
>    CALL Fred ( (/ x,y,z /) )
>    PRINT *, p
> CONTAINS
>    SUBROUTINE Fred (arg)
>        REAL, TARGET, DIMENSION(:) :: arg
>        p => arg
>    END SUBROUTINE Fred
> END PROGRAM Main
>
> Regards,
> Nick Maclaren.
>

