From owner-sc22wg5@open-std.org  Fri Jul  9 02:21:05 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 9B6F8C3BA16; Fri,  9 Jul 2010 02:21:05 +0200 (CEST)
X-Original-To: sc22wg5@open-std.org
Delivered-To: sc22wg5@open-std.org
X-Greylist: delayed 1366 seconds by postgrey-1.18 at www2.open-std.org; Fri, 09 Jul 2010 02:21:04 CEST
Received: from ns.nag-j.co.jp (218-42-159-107.cust.bit-drive.ne.jp [218.42.159.107])
	by www2.open-std.org (Postfix) with ESMTP id D55A9C3BA14
	for <sc22wg5@open-std.org>; Fri,  9 Jul 2010 02:21:04 +0200 (CEST)
Received: from 218-42-159-108.cust.bit-drive.ne.jp ([218.42.159.108] helo=Marucomputer)
	by ns.nag-j.co.jp with smtp (Exim 4.50)
	id 1OX0y8-0007hm-E9
	for sc22wg5@open-std.org; Fri, 09 Jul 2010 08:57:28 +0900
Message-ID: <704ACC95B422460BB834DDEF1C2FB190@Marucomputer>
From: "Malcolm Cohen" <malcolm@nag-j.co.jp>
To: <sc22wg5@open-std.org>
References: <20100708205902.16744C3BA0E@www2.open-std.org>
In-Reply-To: <20100708205902.16744C3BA0E@www2.open-std.org>
Subject: Re: [ukfortran] (SC22WG5.4287) question on move_alloc
Date: Fri, 9 Jul 2010 08:58:22 +0900
Organization: ??NAG
MIME-Version: 1.0
Content-Type: text/plain;
	format=flowed;
	charset="ISO-8859-1";
	reply-type=original
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
Importance: Normal
X-Mailer: Microsoft Windows Live Mail 14.0.8089.726
X-MimeOLE: Produced By Microsoft MimeOLE V14.0.8089.726
Sender: owner-sc22wg5@open-std.org
Precedence: bulk

Reinhold Bader wrote:
> the following program appears to me to be standard-conforming,

Not to me.

> but a
> majority of compilers do not accept it even though they claim to implement
> the MOVE_ALLOC intrinsic:
> 
> program mvall_01
>  implicit none
>  integer, parameter :: n1 = 100, n2 = 2*n1
>  integer, allocatable :: i1(:)
> 
>  allocate(i1(n1))
>  i1 = 1
>  call move_alloc(extd(i1), i1)

Invalid - the arguments of MOVE_ALLOC must be ALLOCATABLE variables.

Note that - VARIABLES.  See 12.5.2.4 para 17, first sentence.

> contains
>  function extd(in) result(out)
>    integer, allocatable :: out(:)
>    integer, intent(in) :: in(:)
>    allocate(out(2*size(in)))
>    out = 2
>  end function
> end program
> 
> Here is what I get in the way of compilation error messages [comments of
> mine in square brackets]:
> *  The argument to the MOVE_ALLOC intrinsic subroutine shall be an
>   allocatable object [but it is, isn't it?]

No.  It does not have the ALLOCATABLE attribute.

> *  FROM argument to intrinsic MOVE_ALLOC is not a variable [well, the
>   standard doesn't say it has to be

Yes it does.  Only variables are definable.

Cheers,
-- 
................................Malcolm Cohen, Nihon NAG, Tokyo.
 
