To: J3 09-241 From: John Reid Subject: LOCK and intent(out) Date: 2009 June 30 References: J3/09-007r2 Discussion It has always been the intention that the only way that a program is allowed to alter a lock variable is via the lock and unlock statements. This is expressed by C1303 and C1304: "C1303 A lock variable shall not appear in a variable definition context except as the lock-variable in a LOCK or UNLOCK statement, or as an actual argument in a reference to a procedure with an explicit interface where the corresponding dummy argument has INTENT(INOUT). C1304 A variable with a subobject of type LOCK TYPE shall not appear in a variable definition context except as an actual argument in a reference to a procedure with an explicit interface where the corresponding dummy argument has INTENT (INOUT)." A variable definition context (16.6.7) includes "(12) an actual argument in a reference to a procedure with an explicit interface if the associated dummy argument has the INTENT (OUT) or INTENT (INOUT) attribute;" Therefore, the constraints cover many cases where a lock variable has intent(out), but not all (the interface need not be explicit if the procedure has a dummy argument that is not a coarray but has a coarray component of type LOCK TYPE). Furthermore, they allow the programmer to write a procedure with a dummy lock variable of intent(out), but disallow any invocation of it. An edit is provided to correct this. Edit to 09-007r2 [97:14+] In 5.3.10 INTENT attribute after C541 add "C541a An entity with the INTENT(OUT) attribute shall not be of the type LOCK_TYPE (13.8.2.16) of the intrinsic module ISO_FORTRAN_ENV or have a subcomponent of this type."