From owner-sc22wg5@open-std.org  Mon Dec  6 21:07:46 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 98C0EC3BA37; Mon,  6 Dec 2010 21:07:46 +0100 (CET)
X-Original-To: sc22wg5@open-std.org
Delivered-To: sc22wg5@open-std.org
Received: from exprod6og102.obsmtp.com (exprod6og102.obsmtp.com [64.18.1.183])
	by www2.open-std.org (Postfix) with ESMTP id 7D78CC3BA1C
	for <sc22wg5@open-std.org>; Mon,  6 Dec 2010 21:07:43 +0100 (CET)
Received: from source ([136.162.34.13]) (using TLSv1) by exprod6ob102.postini.com ([64.18.5.12]) with SMTP
	ID DSNKTP1Cjh+CU7JFlDII84CBI8lhMTVK62zE@postini.com; Mon, 06 Dec 2010 12:07:45 PST
Received: from fortran.us.cray.com (fortran.us.cray.com [172.31.19.200])
	by stplmr01.us.cray.com (8.14.3/8.13.8/hubv2-LastChangedRevision: 12441) with ESMTP id oB6K7fGw025812;
	Mon, 6 Dec 2010 14:07:41 -0600
Message-ID: <4CFD42C0.1050503@cray.com>
Date: Mon, 06 Dec 2010 14:08:32 -0600
From: Bill Long <longb@cray.com>
Reply-To: longb@cray.com
Organization: Cray Inc.
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.11) Gecko/20101013 Thunderbird/3.1.5
MIME-Version: 1.0
To: fortran standards email list for J3 <j3@j3-fortran.org>
Cc: sc22wg5 <sc22wg5@open-std.org>
Subject: Re: (j3.2006) (SC22WG5.4381) [ukfortran] WG5 informal ballot re	Interop.
 TR
References: <20101108175805.5B97EC178E5@www2.open-std.org>	<20101206103130.1AE8AC178E3@www2.open-std.org>	<20101206134148.834A7C178E4@www2.open-std.org>	<4CFD0D53.8030501@cray.com>	<20101206172155.862D5C178DA@www2.open-std.org>	<4CFD2A4D.6070600@cray.com> <20101206190320.30175C3BA1C@www2.open-std.org>
In-Reply-To: <20101206190320.30175C3BA1C@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



On 12/6/10 1:03 PM, Aleksandar Donev wrote:
> On 12/06/10 13:24, Bill Long wrote:
>> If we make that the case, then we have to also allow a C function to
>> call a BIND(C) Fortran subprogram that has a CLASS(*) dummy
> No we don't Bill. An interface with a CLASS(*) dummy is NOT
> interoperable and no one has proposed to make it so. An interface with
> TYPE(*) dummy is. The question is: Can the actual argument be CLASS(*)
> or not.
>
> interface
>       subroutine sub(x) bind(c)
>           type(*), dimension(:) :: x
>       end subroutine
> end interface
>
> CLASS(*), ... :: x(:)
>
> ! Is this allowed and what does the C descriptor get filled with?

I do not see anything that prohibits this.  For this to be valid, the 
actual argument would have to actually have a dynamic type at the point 
of the call below, and be allocated / pointer associated. So the basic 
information needed in the C descriptor seems to be available.

> call sub(x(1:10:2))
>

Even call sub(x) seems OK here.

However, if the dummy were allocatable or pointer, then for the sub(x) 
call,  both the dummy and actual need to be "unlimited polymorphic". 
This is nominally the case if TYPE(*) is unlimited polymorphic, but I 
see this as one of those cases where the base standard might need 
modification to require CLASS(*) instead of "unlimited polymorphic".

Cheers,
Bill


> Aleks
>

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


