J3/08-020r1 To: J3 From: Malcolm Cohen Subject: Cumulative edits for feature changes to the current 007. Date: 2008/10/nn 1. Introduction This document contains the list of edits to J3 for suggested feature changes to the current 007, which is 08-007r2. The edits are in order of occurrence in the 007. Each edit identifies the J3 paper and the meeting number. 2. The papers From meeting 184: 08-143r3 08-147r1 08-154r1 08-165r1 08-166r1 08-168r2 (This has been removed in favour of 256r2, a much nicer number.) 08-178 08-181 From meeting 185: 08-199r1 08-207 08-214 08-217. Actually I changed this one. 08-254r2. Where is the example for this new intrinsic? 08-256r2. Actually I changed this one a bit. 08-266r1. This has some editorial problems. 08-267. 3. The edits [25:2.1.122.1+] After the definition of "local variable", insert new defn "2.1.122.2 <> a scalar variable of type LOCK_TYPE (\ref{LOCK_TYPE}) defined in the intrinsic module ISO_FORTRAN_ENV". {08-256r2, m185} [28:2.2 R214] Add new entries to , alphabetically. "<> " "<> " {08-256r2, m185} [49:4.3.1.1p1 C407] Delete the last sentence "It shall not have the VALUE attribute." {08-147r1, m184} [59:4.5.2.1 C432+] After C432 add a new constraint: "C432a (R425) If EXTENDS appears and the type being defined has an ultimate component of type LOCK_TYPE defined in the intrinsic module ISO_FORTRAN_ENV, its parent type shall have an ultimate component of type LOCK_TYPE." {08-256r2, m185} [74:4.5.6.3p8] Insert ", noncoindexed " before "object". {08-199r1, m185} [74:4.5.6.3p9] After "is executed" (but before the comma), Insert "and the variable is not a coindexed object". {08-199r1, m185} [74:4.5.6.4p1+] After the paragraph but before Note 4.50, Insert new paragraph "Coindexed objects are not finalized." {08-199r1, m185} [99:5.3.18p1 C556] Replace entire constraint "An entity ... dummy data object." with "C556 An entity with the VALUE attribute shall be a dummy data object that is not an assumed-size array." {08-147r1, m184} [99:5.3.18p1 C558] Delete constraint "If an entity ... initialization expression." {08-147r1, m184} [115:6.2] After the heading "6.2 Variable", Begin new subclause with "6.2.1 General". {08-256r2, m185} [116:6.3-] Immediately before "6.3 Constants" insert new subclause "6.2.2 Lock variables A <> is a scalar variable of type LOCK_TYPE (\ref{LOCK_TYPE}) defined in the intrinsic module ISO_FORTRAN_ENV. A lock variable can have one of two values: locked or unlocked. The value of a lock variable can be changed with the LOCK and UNLOCK statements (8.5.4a). Cxxx: A data entity that is or has an ultimate component of type LOCK_TYPE defined in the intrinsic module ISO_FORTRAN_ENV shall be a coarray. A lock variable shall not appear as: (1) the variable of an , (2) an actual argument in a reference to a procedure if the associated dummy argument has the INTENT(OUT) attribute, (3) the in an ALLOCATE statement in which SOURCE= appears, or (4) the selector in a SELECT TYPE or ASSOCIATE construct if the associate name of that construct appears in one of the above contexts. NOTE 6.1a Copying or changing the value of a lock other than via the LOCK and UNLOCK statements might not be safe if the copy or definition is not performed atomically and another image acquires or releases the lock without proper synchronization. Additionally, not allowing the copying of locks gives freedom to implement the opaque type LOCK_TYPE without affecting the semantics of programs. The requirement that lock variables be coarrays or subobjects of coarrays ensures that no copying occurs due to argument association and that they are efficiently accessible from remote images. [End NOTE]" {08-256r2, m185} [117:6.4.2 C616+] Insert new constraint "C616a (R611) If appears, shall not be polymorphic or be a type that has an allocatable ultimate component that is either polymorphic or of a derived type with length type parameters." {08-256r2, m185} [157:7.2.2.2 C728+] Add new constraint "C728a (R741) The shall not be a coindexed object." {08-143r3, m184} {The editor comments that this would be better done by modifying C728.} [179:8.1.7.7 C826] After this constraint add a new one: "C826a An image control statement shall not appear within a DO CONCURRENT construct." {08-214, m185} [187:8.5.1p2] Add new bullet item to list after the "CRITICAL" one "\item LOCK or UNLOCK statement;" {08-256r2, m184} [191:Note 8.39+] Immediately before 8.5.5 "STAT= and ERRMSG= ...", add a new subclause "8.5.4a LOCK and UNLOCK statements R862a <> LOCK ( [, ] ) R862b <> ACQUIRED_LOCK= <> R862c <> UNLOCK ( [, ] ) R862d <> C851a (R862d) A shall be a lock variable (\ref{6.2.2 Lock variable}) The values of a lock variable denote the state of a lock. A lock is acquired by setting the value of the lock variable to locked, and released by setting the value to unlocked. A lock variable is currently locked by an image if its value was set to locked by that image and has not been subsequently set to unlocked. Successful execution of a LOCK statement without an ACQUIRED_LOCK= specifier causes the to become defined with the value locked. If the lock variable is currently locked by a different image, execution of the LOCK statement completes when the lock is released by the other image and acquired by this image. If a has the value unlocked, successful execution of a LOCK statement with an ACQUIRED_LOCK= specifier causes the to become defined with the value locked and the value of the to become defined with the value true. Otherwise, the is not changed and the value of the becomes defined with the value false. Successful execution of an UNLOCK statement causes the value of the to be set to unlocked. An error condition occurs if the in a LOCK statement is currently locked by the executing image. An error condition occurs if the in an UNLOCK statement is not currently locked by the executing image. If an error condition occurs during the execution of a LOCK or UNLOCK statement the value of is not changed. NOTE 8.39a A lock variable is effectively defined atomically by a LOCK or UNLOCK statement. If LOCK statements on two images both attempt to acquire a lock, one will succeed and the other will either fail if an ACQUIRED_LOCK= specifier appears, or will wait until the lock is later released if an ACQUIRED_LOCK= specifier does not appear. [End NOTE] NOTE 8.39b An image might wait for a LOCK statement to successfully complete for a long period of time if other images frequently lock and unlock the same lock varaible. This situation might result from executing LOCK statements with ACQUIRED_LOCK= specifiers inside a spin loop. [End NOTE] NOTE 8.39c The following example illustrates the use of LOCK and UNLOCK statements to manage a work queue: USE, INTRINSIC :: ISO_FORTRAN_ENV TYPE(LOCK_TYPE) :: queue_lock[*] ! Lock to manage the work queue INTEGER :: work_queue_size[*] TYPE(Task) :: work_queue(100)[*] ! List of tasks to perform TYPE(Task) :: job ! Current task working on INTEGER :: me me=THIS_IMAGE() DO ! Process the next item in your work queue LOCK(queue_lock) ! New segment A starts ! This segment A is ordered with respect to ! segment B executed by image me-1 below because of lock exclusion IF(work_queue_size>0) THEN ! Fetch the next job from the queue job=work_queue(work_queue_size) work_queue_size=work_queue_size-1 END IF UNLOCK(queue_lock) ! Segment ends ... ! Actually process the task ! Add a new task on neighbors queue: LOCK(queue_lock[me+1]) ! Starts segment B ! This segment B is ordered with respect to ! segment A executed by image me+1 above because of lock exclusion IF(work_queue_size[me+1] is currently locked by the executing image, the specified variable becomes defined with the value of STAT_LOCKED (\ref{}). If the STAT= specifier appears in an UNLOCK statement and the has the value unlocked, the specified variable becomes defined with the value of STAT_UNLOCKED (\ref{}). If the STAT= specifier appears in an UNLOCK statement and the is currently locked by a different image, the specified variable becomes defined with the value STAT_LOCKED_OTHER_IMAGE. The constants STAT_LOCKED, STAT_UNLOCKED, and STAT_LOCKED_OTHER_IMAGE are defined in the intrinsic module ISO_FORTRAN_ENV. If a STAT= specifier appears and any other error occurs during execution of a LOCK or UNLOCK statement, the specified variable becomes defined with a positive integer value that is different from STAT_LOCKED, STAT_UNLOCKED, and STAT_LOCKED_OTHER_IMAGE. If an error occurs during execution of a LOCK or UNLOCK statement that does not contain the STAT= specifier, error termination of execution is initiated." {08-256r2, m185} [192:8.5.5p2] Change "SYNC IMAGES, or SYNC MEMORY" to "SYNC IMAGES, SYNC MEMORY, LOCK, or UNLOCK". {08-256r2, m185} {The editor wonders why not alphabetic order, like it was originally.} [243:10.3.2 C1007] Constraint begins "For the G edit descriptor", delete "and only if". {08-251r3, m185} [243:10.3.2 C1007+] Insert new constraint "C1007a (R1006) For the G edit descriptor, shall not be specified if is zero." {08-251r3, m185} [253:10.7.5.1p1] After "the external field occupies positions", change "; for" to ". For". {08-251r3, m185} [254:10.7.5.2.2p2] After "the G0", Change "edit descriptor follows" -> "and G0. edit descriptors follow"; After ", " insert "(if not specified)". {08-251r3, m185} [268:11.2.2p1] Replace last sentence "A submodule ... indirectly." with "A submodule shall not access any entity from its ancestor module by use association, directly or indirectly." {08-154r1, m184} [277:12.4.3.2 C1207] Replace constraint "A ... or module procedure" with "C1207 (R1206) A shall be a nonintrinsic procedure that has an explicit interface." {08-178, m184} [285:12.5.1 C1230+] Add new constraint "C1230a (R1221) shall not be a coindexed object." {08-143r3, m184} [286:12.5.1 Note 12.16] Delete Note 12.16. {08-143r3, m184} [291:12.5.2.4 C1237] After "coindexed object" insert "with the ASYNCHRONOUS or VOLATILE attribute". {08-165r1, m184} [291:12.5.2.4 C1238] After "nonpointer array that" insert "has the ASYNCHRONOUS or VOLATILE attribute but". {08-165r1, m184} [291:12.5.2.4 C1239] After "array pointer that" insert "has the ASYNCHRONOUS or VOLATILE attribute but". {08-165r1, m184} [291:12.5.2.4 Note 12.27] After "The constraints on" Change "actual arguments that correspond" To "an actual argument with the ASYNCHRONOUS or VOLATILE attribute that corresponds" {08-165r1, m184} [290:12.5.2.4p9] Change "is either a" to "either the effective argument is simply contiguous or the dummy argument is". {08-166r1, m184} [290:12.5.2.4p10] After "but" insert "is not simply contiguous and". {08-166r1, m184} [291:12.5.2.4 Note 12.27] After "Making a copy of" Change "actual arguments whose values are" To "an actual argument whose value is", And change "those new values" to "the new value". {08-165r1, m184} [308:12.7 C1274] After "all its nonpointer dummy data objects have" Change "INTENT (IN)" To "the INTENT (IN) or the VALUE attribute". {08-181, m184} [308:12.7 C1275] After "dummy data objects" Insert "that do not have the VALUE attribute". {08-181, m184} [308:12.7 C1280] After "is a dummy argument of a pure function" Insert "that does not have the VALUE attribute". {08-181, m184} [310:12.8.1p2 C1288] After "RANGE," insert "STORAGE_SIZE,". {08-207, m185} [318:Table 13.1] Immediately before the CONJG entry insert new entry "COMPLEX (RE, IM) E Conversion to complex type with the same kind type parameter as RE and IM." {08-266r1, m185} {The editor notes that this conflicts with the edit for 337, which has a different description. If we add this feature, it must be done right.} [322:Table 13.1] Add a new entry. "TYPE_IS_EXTENSIBLE (A) I True if and only if dynamic type of A is extensible." {08-254r2, m185} [337:13.7.38-] Immediately before the CONJG subclause insert new subclause "13.7.37+ <> <> Conversion to complex type. <> Elemental function. <> RE and IM are of type real with the same kind type parameter. <> Complex with the same kind type parameter as RE and IM. <> The complex number with real part RE and imaginary part IM. <> COMPLEX(A, B) is (3.0, 4.5) if A has the value 3.0 and B has the value 4.5." {08-266r1, m185} {The editor notes that this does not have the required format.} [321:Table 13.1] In the entry for NORM2, change "X" to "ARRAY". {08-217, m185} [373-374:13.7.123] In the subclause for "NORM2(X[,DIM])", Change every occurrence of "X" to "ARRAY". {The editor thinks this should not change in the example.} [393:13.7.169+] Add new intrinsic subclause "13.7.169a <> <> True if and only if the dynamic type of A is extensible. <> Inquiry function <> A may be of any type. It may be a scalar or array. If it is a pointer, it shall not have an undefined association status. If it is an unlimited polymorphic pointer, it shall be associated if it is a pointer and allocated if it is allocatable. <> Default logical scalar. <> The result is true if and only if the dynamic type of A is extensible." [397:13.8.2.13+] Immediately before 13.8.2.14 "LOGICAL_KINDS" add new subclause "13.8.2.13a LOCK_TYPE LOCK_TYPE is a derived type with private nonpointer, nonallocatable, noncoarray components. It does not have the BIND(C) attribute or type parameters, and is not a sequence type. Variables of type LOCK_TYPE are default initialized to the value representing unlocked. Variables of type LOCK_TYPE are used as s in LOCK or UNLOCK statements (\ref{LOCK and UNLOCK statements}). The uses of variables of type LOCK_TYPE are restricted (\ref{6.2.2 Lock variables})." {08-256r2, m185} [398:3.8.2.18+] Immediately before 13.8.2.19 "STAT_STOPPED_IMAGE", add new subclauses "13.8.2.18a STAT_LOCKED The value of the default integer scalar constant STAT_LOCKED is assigned to the variable specified in a STAT= specifier (8.5.5) of a LOCK statement if the lock specified by is currently locked by the executing image. 13.8.2.18b STAT_LOCKED_OTHER_IMAGE The value of the default integer scalar constant STAT_LOCKED_OTHER_IMAGE is assigned to the variable specified in a STAT= specifier (8.5.5) of an UNLOCK statement if the lock specified by is currently locked by an image different from the executing image." {08-256r2, m185} [398:3.8.2.19+] At the end of clause 13, add new subclause "13.8.2.19a STAT_UNLOCKED The value of the default integer scalar constant STAT_UNLOCKED is assigned to the variable specified in a STAT= specifier (8.5.5) of an UNLOCK statement if the lock specified by is currently not locked by any image." {08-256r2, m185} [454:16.6.5 at the end] Add new list items "(29) Execution of a LOCK statement containing an ACQUIRED_LOCK= specifier causes the specified logical variable to become defined. If the logical variable becomes defined with the value true, the in the LOCK statement also becomes defined. (30) Successful execution of a LOCK statement that does not contain an ACQUIRED_LOCK= specifier causes the to become defined. (31) Successful execution of an UNLOCK statement causes the to become defined." {08-256r2, m185} [456:16.6.7p1 (13)] Change final "." to ";" and append new items "(14) a in a LOCK or UNLOCK statement; (15) an ACQUIRED_LOCK= specifier in a LOCK statement." {08-256r2, m185} ===END===