Re: STAT= variable with ALLOCATE

jon wrote:
>> I have always understood that when a STAT= variable is
>> used with ALLOCATE, the value returned should be zero
>> if the allocation is successful and is a processor-dependent
>> positive value when an error occurs on allocation.

>> 1) Is this true?

>> Yes.

That was not the response I received when I asked the same
question on the J3 mailing list. One of the members of the
committee (1100) gave the example of an operating system
that could not tell if enough space was available to satisfy the

Section 6.3.1 of the Fortran 2003 standard states

If an error condition occurs during the execution of the
ALLOCATE statement, the stat-variable becomes defined
with a processor-dependent positive value and each
allocate-object will have a processor-dependent status, ...

The standard does not say that not having enough space to
satisfy the ALLOCATE statement is an error condition.

A strict reading of the standard as written would prohibit a
processor from treating lack of space as an error condition.
The standard explicitly allows a processor to define I/O
error conditions beyond those defined in the standard (see
Section 9.10). The standard does not say that a processor
can define error conditions for the ALLOCATE and
DEALLOCATE statements beyond those allowed in the
standard. In an e-mail exchange on the J3 mailing list, a
member of the committee cited the lack of permission to add
error conditions beyond those specified in the standard as
proof that a DEALLOCATE statement must succeed unless
one of the error conditions specified in the standard holds.

I believe the committee intended to allow processors to define
error conditions beyond those specified in the standard. I
believe that either the members of the committee thought it
was obvious that a processor could add processor-dependent
error conditions or they overlooked the need for a statement to
that effect.

Bob Corbett