(j3.2006) INQUIRE by output list

Bill Long longb
Wed Aug 21 18:55:21 EDT 2013



On 8/20/13 8:18 PM, Malcolm Cohen wrote:
>> The INQUIRE statement form used to determine a record size has the
>> syntax form
>>
>>    INQUIRE (IOLENGTH=<scalar-int-variable>)  <output-item-list>
>>
>> The <output-item> can be a simple variable name.  But the rules for the
>> syntax term  <output-item> appear to require that the variable be
>> defined.
>
> Sorry, not seeing it.
>
> "A data object is referenced when its value is required during execution."

We also say

"An expression represents either a data reference or a computation, and 
its value is either a scalar or an array."

and <output-item> traces back to an expression.

I agree that in this case it is not necessary for the <output-item> to 
be defined, and that the other requirements for <output-item> are useful 
(such as allocated or pointer associated).  I also agree that a new 
syntax name is not desirable.

In other uses of <output-item> definition is required.  It is certainly 
possible to tell the compiler "make an exception in the case of INQUIRE 
that <output-item> can be undefined".  But should we say that in the 
standard as well? Even as just a Note.  (Or did we already, and I just 
missed it?)


Cheers,
Bill

>
> So considering an <output-item> that is an <expr> that is a variable name, sure
> the expression produces a value, but the point is that this is not actually
> required for INQUIRE IOLENGTH=, unless the IOLENGTH= result can depend on the
> value produced.  I guess that is actually conceivable, if unformatted i/o writes
> compressed records (I don't know of any such system).  So at worst we have the
> situation that the <output-item> in this context *might* be required to be
> defined, if the processor needs the value.
>
> FWIW, we (NAG) do undefined variable detection, and do not consider this to be a
> case where it is needed to be defined.
>
> Is it worth writing extra syntax (<inquire-item>) to require the processor not
> to need the value here?  I don't think so, especially as it would involve
> duplicating all the <output-item> requirements we actually do want into the new
> <inquire-item>; sounds like a cure worse than the disease.  Others may differ.
>
> Cheers,
>

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