From owner-sc22wg5@open-std.org  Sat Mar 28 12:16:54 2009
Return-Path: <owner-sc22wg5@open-std.org>
X-Original-To: sc22wg5-dom7
Delivered-To: sc22wg5-dom7@www2.open-std.org
Received: by www2.open-std.org (Postfix, from userid 521)
	id 1A5AEC76BB3; Sat, 28 Mar 2009 12:16:54 +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; Sat, 28 Mar 2009 12:16:53 CET
Received: from mailrelay1.lrz-muenchen.de (mailrelay1.lrz-muenchen.de [129.187.254.106])
	by www2.open-std.org (Postfix) with ESMTP id 2FB88C56D20
	for <sc22wg5@open-std.org>; Sat, 28 Mar 2009 12:16:53 +0100 (CET)
Received: from [129.187.48.218] ([129.187.48.218] [129.187.48.218]) by mailout.lrz-muenchen.de with ESMTP; Sat, 28 Mar 2009 12:01:29 +0100
Message-Id: <49CE0389.6080009@lrz.de>
Date: Sat, 28 Mar 2009 12:01:29 +0100
From: Reinhold Bader <Reinhold.Bader@lrz.de>
User-Agent: Thunderbird 2.0.0.19 (Windows/20081209)
MIME-Version: 1.0
To: Robert.Corbett@sun.com, WG5 <sc22wg5@open-std.org>
Subject: Re: (j3.2006) question about deallocation
References: <49CACA36.5070104@nag-j.co.jp> <49CDEC08.8040403@sun.com>
In-Reply-To: <49CDEC08.8040403@sun.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Sender: owner-sc22wg5@open-std.org
Precedence: bulk

Hello,

Robert Corbett schrieb:
> Consider the code fragment
>
>        MODULE M
>          . . .
>          TYPE BASE
>            INTEGER I
>          CONTAINS
>            FINAL SUBR1
>          END TYPE
>          TYPE, EXTENDS(BASE) :: EXTENDED
>          CONTAINS
>            FINAL SUBR2
>          END TYPE
>          . . .
>        END MODULE
>
>        PROGRAM MAIN
>          USE M
>          TYPE(EXTENDED), POINTER :: P
>          TYPE(BASE), POINTER :: Q
>          . . .
>          ALLOCATE(P)
>          Q => P%BASE
>          . . .
>          DEALLOCATE(Q)
>          . . .
>        END
>
> Is the DEALLOCATE statement standard conforming? 
I think it isn't. Clause 6.3.3.2 of the 2003 standard says that

"If a pointer appears in a DEALLOCATE statement, it shall be associated 
with the whole of an object
that was created by allocation."

Surely this rule is also applicable for the case of type extension.

Regards
>  If so,
> are both final subroutines invoked, or is only SUBR1
> invoked?  The implementation of deallocation in Sun
> Fortran can easily be extended to support either
> semantics.
>
> Bob Corbett
> _______________________________________________
> J3 mailing list
> J3@j3-fortran.org
> http://j3-fortran.org/mailman/listinfo/j3
>   

