To: J3 10-206r1 From: John Reid, Bill Long Subject: Interop TR: CFI_allocate and CFI_deallocate Date: 2010 October 13 References: 10-165r2, ISO/IEC 1539-1:2010 DISCUSSION It is stated in 5.2.6.2 of 10-165r2 that CFI_allocate uses the same mechanism as the Fortran ALLOCATE statement, but the conditions are not the same. Similarly, it is stated in 5.2.6.3 that CFI_deallocate uses the same mechanism at the Fortran DEALLOCATE statement, but the conditions are not the same. Edits are proposed to correct this. Furthermore, an edit is proposed to allow the DEALLOCATE statement to deallocate a pointer target that was allocated by CFI_allocate. Malcolm Cohen suggests eliminating the state member. He says "Just requiring the address field to be non-null would be sufficient, and nicer to use. Whether the underlying Fortran implementation uses a null address for zero-sized allocations or not, the right thing to do is to hide the processor dependency from the user, not expose it." Edits for this are provided. EDITS to 10-165r2: [9:22]. Replace "If the object has zero size, the value is processor-dependent." by "If the object has zero size, the value is not NULL but is otherwise processor dependent." [9:35-36]. Delete the lines for int state. [Note to editor: Also delete references to CFI_state_t introduced by 10-203r2.] [12:3] Change "On entry, the base address in the C descriptor shall be NULL. The" to "On entry, the". [12:4] Change "disassociated" to "a". [12:4-5] Change "The supplied" to "On successful execution of CFI_allocate, the supplied", and move this sentence to be after the sentence at [12:6] ending "... assumed to be one." [12:11] Change "On entry, the base address in the C descriptor shall not be NULL. The" to "On entry, the". [12:12-13] Change "that was allocated ... statement" to "satisfying the conditions for successful deallocation by the Fortran DEALLOCATE statement (6.7.3.3 of ISO/IEC 1539-1:2010)". [13] Add a new section: 5.3 Interaction with the DEALLOCATE statement The DEALLOCATE statement shall treat a pointer whose target was allocated using CFI_allocate in exactly the same way as if it were allocated using an ALLOCATE statement.