(j3.2006) Question I forgot to bring up at the meeting

Lionel, Steve steve.lionel
Tue Jul 9 15:38:52 EDT 2013


Not seeing any further discussion on this - I'd be reluctant to make it illegal, as that would block use VOLATILE elsewhere, not just in specification expressions. Perhaps we could add a statement such as:

"If a variable in a specification expression has the VOLATILE attribute, it is processor-dependent how many times the variable's value is accessed during evaluation of array bounds and length type parameters."

Steve

-----Original Message-----
From: j3-bounces at mailman.j3-fortran.org [mailto:j3-bounces at mailman.j3-fortran.org] On Behalf Of Bill Long
Sent: Tuesday, July 09, 2013 11:34 AM
To: fortran standards email list for J3
Subject: Re: (j3.2006) Question I forgot to bring up at the meeting



On 7/9/13 8:53 AM, Lionel, Steve wrote:
> F08, p94 (Explicit shape arrays), paragraph 2 says:
>
> "The bounds, and hence shape, are determined on entry to a procedure defined by the subprogram, or on execution of the BLOCK statement, by evaluating the bounds' expressions. The bounds of each array are unaffected by the redefinition or undefinition of any variable during execution of the procedure or BLOCK construct."
>
> I don't see similar wording for type-param-values, though paragraph 8 on p50 implies something similar.
>
> A literal reading of this would imply, to me, that the compiler should take a single snapshot of any volatile variable, used in specification expressions, on entry to the procedure or block, and then reference that copy.  I could see this as possibly conflicting with the description of VOLATILE which says, in a note, that the processor "should use the most recent definition".
>

Exactly.  Basically the only thing that VOLATILE does is to cause the generate code to never snap a temp and always go to memory for the value.  If we want to allow VOLATILE variables in specification expressions, either we should warn the users about curious effects, or say that for the purposes of its use in a specification expression, treat the variable as if it did not have the VOLATILE attribute. 
Alternatively,  just disallow it, an option that I think was implied by Van's original post.

Cheers,
Bill


> Steve
>
> -----Original Message-----
> From: j3-bounces at mailman.j3-fortran.org 
> [mailto:j3-bounces at mailman.j3-fortran.org] On Behalf Of Bill Long
> Sent: Tuesday, July 09, 2013 12:06 AM
> To: Van.Snyder at jpl.nasa.gov; fortran standards email list for J3
> Subject: Re: (j3.2006) Question I forgot to bring up at the meeting
>
> What about a simple case like this:
>
> subroutine wobbly(N)
>     integer,volatile :: N
>     real :: A(N + N)
>     real :: B(2 *N)
>
> Are you sure that A and B are the same size?  Assuming the compiler does not optimize the bound expressions,  is it allowed that the computations of N + N and 2*N give different answers if N is volatile?
>
> Cheers,
> Bill
>
>
> On 7/8/13 8:18 PM, Van Snyder wrote:
>> On Mon, 2013-07-08 at 18:41 +0000, Lionel, Steve wrote:
>>> Why would that be an issue?
>>
>> If the dummy argument is, say D, and the specification expression 
>> consists of D, then one could determine what the value of D was at 
>> the instant the specification expression was used for, say, an array 
>> bound by using, say, UBOUND(A,1).  If the specification expression is 
>> F(D), where F is some arbitrary specification function, it might be a 
>> bit tricky to invert F to discover what value D had when F(D) was computed.
>>
>> Maybe that's not a problem.
>>
>>>
>>> Steve
>>>
>>> -----Original Message-----
>>> From: j3-bounces at mailman.j3-fortran.org 
>>> [mailto:j3-bounces at mailman.j3-fortran.org] On Behalf Of Van Snyder
>>> Sent: Monday, July 08, 2013 2:34 PM
>>> To: j3
>>> Subject: (j3.2006) Question I forgot to bring up at the meeting
>>>
>>> Do we want to allow a dummy argument with the VOLATILE attribute in a specification expression?
>>>
>>>
>>> _______________________________________________
>>> J3 mailing list
>>> J3 at mailman.j3-fortran.org
>>> http://mailman.j3-fortran.org/mailman/listinfo/j3
>>> _______________________________________________
>>> J3 mailing list
>>> J3 at mailman.j3-fortran.org
>>> http://mailman.j3-fortran.org/mailman/listinfo/j3
>>
>>
>> _______________________________________________
>> J3 mailing list
>> J3 at mailman.j3-fortran.org
>> http://mailman.j3-fortran.org/mailman/listinfo/j3
>>
>

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


_______________________________________________
J3 mailing list
J3 at mailman.j3-fortran.org
http://mailman.j3-fortran.org/mailman/listinfo/j3



More information about the J3 mailing list