(j3.2006) (DE)ALLOCATE with STAT= question

Bill Long longb
Wed Dec 21 11:57:47 EST 2011



On 12/20/11 6:37 PM, Malcolm Cohen wrote:

>
>> - The STAT= value is STAT_STOPPED_IMAGE in all cases, independent of the order.
>
> Not necessarily.
>

Standard says necessarily.  See below.

>> Is this the correct reading? Or can be the value for STAT= also different?
>
> (1) Each allocate-object has a processor-dependent status.
> (2) the stat-variable becomes defined with a processor-dependent positive
> integer
>
> I do not see how you can blithely ignore these clear statements in the standard.
>

The standard says [132:7-10]:

"If an ALLOCATE or DEALLOCATE statement with a coarray allocate-object 
is executed when one or more images has initiated termination of 
execution, the stat-variable becomes defined with the 
processor-dependent positive integer value of the constant 
STAT_STOPPED_IMAGE from the intrinsic module ISO_FORTRAN_ENV (13.8.2)."

The initial "If" part of the statement is satisfied for ALLOCATE 
(A(100)[*], B(100)), so if the allocation fails for the reason stated, 
the value of the STAT= variable is not processor dependent, but is 
STAT_STOPPED_IMAGE.  There are no exceptions for something else going 
wrong with the allocate statement, such as a problem with B.  So, I 
agree with Tobias' statement above.  For this one case, the standard is 
specific.  For all the other reasons for failure, I agree that the STAT= 
value is processor dependent in the case of failure.


......

> is not conforming.  I do not believe that we intended this, but on the other
> hand mixing ALLOCATE/DEALLOCATE of coarrays and noncoarrays looks rather
> reckless.
>

I agree that it is a good programming practice to not mix coarrays and 
noncoarrays in allocate/deallocate statements.  Perhaps even a Note 
candidate in the next revision.

Cheers,
Bill



-- 
Bill Long                                           longb at 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





More information about the J3 mailing list