From owner-sc22wg5@open-std.org  Thu Jul  8 23:09:33 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 56C05C3BA16; Thu,  8 Jul 2010 23:09:33 +0200 (CEST)
X-Original-To: sc22wg5@open-std.org
Delivered-To: sc22wg5@open-std.org
Received: from mail2.cray.com (mail2.cray.com [136.162.64.100])
	by www2.open-std.org (Postfix) with ESMTP id 811BFC3BA14
	for <sc22wg5@open-std.org>; Thu,  8 Jul 2010 23:09:31 +0200 (CEST)
Received: from sealmr01.us.cray.com (sealmr01.us.cray.com [172.28.74.60])
	by mail2.cray.com (8.13.6/8.13.3/gw-5323) with ESMTP id o68L9Sum012630
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL);
	Thu, 8 Jul 2010 14:09:28 -0700 (PDT)
Received: from cfexcas02.americas.cray.com (cfexcas02.americas.cray.com [172.30.74.223])
	by sealmr01.us.cray.com (8.14.3/8.13.8/hubv2-LastChangedRevision: 12029) with ESMTP id o68L9S2e004149;
	Thu, 8 Jul 2010 14:09:28 -0700
Received: from fortran.us.cray.com (172.31.19.200) by
 cfexcas02.americas.cray.com (172.30.74.226) with Microsoft SMTP Server (TLS)
 id 8.1.436.0; Thu, 8 Jul 2010 16:09:27 -0500
Message-ID: <4C363E8F.8020307@cray.com>
Date: Thu, 8 Jul 2010 16:09:35 -0500
From: Bill Long <longb@cray.com>
Reply-To: <longb@cray.com>
Organization: Cray Inc.
User-Agent: Thunderbird 2.0.0.24 (Macintosh/20100228)
MIME-Version: 1.0
To: fortran standards email list for J3 <j3@j3-fortran.org>
Cc: "sc22wg5@open-std.org" <sc22wg5@open-std.org>
Subject: Re: (j3.2006) (SC22WG5.4287) question on move_alloc
References: <20100708205902.16744C3BA0E@www2.open-std.org>
In-Reply-To: <20100708205902.16744C3BA0E@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



Reinhold.Bader@lrz.de wrote:
> Hello all,
> 
> the following program appears to me to be standard-conforming, 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)

It is difficult to know if the execution is correct. I'd suggest adding 
something like

   print *, i1(1), size(i1)

at this point.  I would expect this output:

 > ./a.out
  2,   200


Cheers,
Bill



> 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?]
> *  FROM argument to intrinsic MOVE_ALLOC is not a variable [well, the
>    standard doesn't say it has to be
> *  Argument of invalid INTENT [sure - there isn't one and none is required]
> *  number or type of arguments to move_alloc [how that?]
> *  linkage error: undefined reference to `move_alloc__' [you bad RTL]
> 
> There actually also is one compiler which builds and runs this correctly :-)
> 
> Any comments?
> 
> Reinhold
> 
> _______________________________________________
> J3 mailing list
> J3@j3-fortran.org
> http://j3-fortran.org/mailman/listinfo/j3

-- 
Bill Long                                           longb@cray.com
Fortran Technical Support    &                 voice: 651-605-9024
Bioinformatics Software Development            fax:   651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101


