From owner-sc22wg5@open-std.org  Thu Jul  8 22:59:01 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 D31DCC3BA14; Thu,  8 Jul 2010 22:59:01 +0200 (CEST)
X-Original-To: sc22wg5@open-std.org
Delivered-To: sc22wg5@open-std.org
Received: from mailrelay2.lrz-muenchen.de (mailrelay2.lrz-muenchen.de [129.187.254.102])
	by www2.open-std.org (Postfix) with ESMTP id 3EE91C3BA0E
	for <sc22wg5@open-std.org>; Thu,  8 Jul 2010 22:58:58 +0200 (CEST)
Received: from webmail.lrz-muenchen.de ([129.187.254.85] [129.187.254.85]) by mailout.lrz-muenchen.de with ESMTP; Thu, 8 Jul 2010 22:58:34 +0200
Received: from p5de97eb6.dip.t-dialin.net ([93.233.126.182])
        (SquirrelMail authenticated user a2832ba)
        by webmail.lrz-muenchen.de with HTTP;
        Thu, 8 Jul 2010 22:58:34 +0200 (CEST)
Message-Id: <60302.93.233.126.182.1278622714.squirrel@webmail.lrz-muenchen.de>
Date: Thu, 8 Jul 2010 22:58:34 +0200 (CEST)
Subject: question on move_alloc
From: Reinhold.Bader@lrz.de
To: sc22wg5@open-std.org
User-Agent: SquirrelMail/1.4.13
MIME-Version: 1.0
Content-Type: text/plain;charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Sender: owner-sc22wg5@open-std.org
Precedence: bulk

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)
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

