J3/14-138r2 To: J3 Subject: LOCK_TYPE and POINTER From: Van Snyder Date: 2014 May 29 1. Introduction =============== One cannot have a pointer of type LOCK_TYPE because C1302 requires a named variable of type LOCK_TYPE to be a coarray, while C526 requires a coarray to be allocatable or a dummy argument. One can have a pointer component of type LOCK_TYPE. This asymmetry is undesirable. 2. Proposal =========== Eliminate C1302. Instead constrain to be a coarray, a coindexed object, or a pointer in C854. In pointer assignment, if a is of type LOCK_TYPE, or of a type that has a noncoarray potential subobject component of type LOCK_TYPE, constrain the to be a coarray or a pointer. Thereby, by induction, a LOCK_TYPE pointer can only be associated with a coarray. 4. Edits to 14-007r1 ==================== [6:19+] Define a new term "1.3.35.2a <> a nonpointer component, or a potential subobject component of a nonpointer component" [160:16+] Insert a constraint: "C719a (R733) If is of type LOCK_TYPE, or is of a type that has a noncoarray potential subobject component of type LOCK_TYPE, shall be a pointer or a coarray." [194:6 C854] Append ", and shall be a pointer, a coarray, or a coindexed object". [402:22-23 C1302] Delete C1302. [402:25 C1303] After "" insert "that is not a pointer in a DEALLOCATE statement, as an that is not a pointer in an ALLOCATE statement provided a SOURCE= specifier does not appear, as a or in a , as a in a NULLIFY statement, as an actual argument in a reference to a procedure with explicit interface if the corresponding dummy argument has the POINTER attribute". [402:28 C1304] After "" insert "that is not a pointer in a DEALLOCATE statement, as an that is not a pointer in an ALLOCATE statement provided a SOURCE= specifier does not appear, as a or in a , as a in a NULLIFY statement, as an actual argument in a reference to a procedure with explicit interface if the corresponding dummy argument has the POINTER attribute". Alternatively, use lists in C1303 and C1304: C1303 A lock variable shall not appear in a variable definition context except as (1) the in a LOCK or UNLOCK statement, (2) an that is not a pointer in a DEALLOCATE statement, (3) an that is not a pointer in an ALLOCATE statement, provided a SOURCE= specifier does not appear, (4) a or in a , (5) a in a NULLIFY statement, (6) an actual argument in a reference to a procedure with explicit interface if the corresponding dummy argument has the POINTER attribute, or (7) an actual argument in a reference to a procedure with explicit interface if the corresponding dummy argument has the INTENT(INOUT) attribute. C1304 A varable with a subobject of type LOCK_TYPE shall not appear in a variable definition context except as (1) an that is not a pointer in a DEALLOCATE statement, (2) an that is not a pointer in an ALLOCATE statement provided a SOURCE= specifier does not appear, (3) a or in a , (4) a in a NULLIFY statement, (5) an actual argument in a reference to a procedure with explicit interface if the corresponding dummy argument has the POINTER attribute, or (6) an actual argument in a reference to a procedure with explicit interface if the corresponding dummy argument has the INTENT(INOUT) attribute. The condition "an that is not a pointer" is desirable but not strictly necessary. A coarray has to be either allocatable or a dummy argument, and deallocating an allocatable variable that is a target of a pointer by way of the pointer is prohibited. But... that's not a constraint.