J3/15-113r3 To: J3 Subject: UTI 005 From: Dan Nagle & Steve Lionel & Daniel Chen & Malcolm Cohen Date: 2015 February 26 Reference: 15-011, 15-007 1. Introduction This paper addresses UTI 005, which complains about a statement that an effective arguments might be an address of a C descriptor. 2. Edits to 15-007 [454:1-6] 15.3.7 Interoperability of procedures and procedure interfaces, p5, replace paragraph with the following paragraph(s). "When an interoperable Fortran procedure with a simply contiguous dummy argument is invoked from C and the actual argument is the address of a C descriptor for a discontiguous object, the Fortran processor shall handle the difference in contiguity. When an interoperable C procedure whose Fortran interface has a simply contiguous dummy argument is invoked from Fortran and the effective argument is discontiguous, the Fortran processor shall ensure that the C procedure receives a descriptor for a contiguous object. When an interoperable C procedure whose Fortran interface has a simply contiguous dummy argument is invoked from C, and the actual argument is the address of a C descriptor for a discontiguous object, the C code within the procedure shall be prepared to handle the discontiguous argument.". {Set out the rules. Note we don't need the Fortran calling Fortran case as that is already covered by clause 12 (the rules there apply both to interoperable and non-interoperable procedures).} [454:6+1-7] Delete UTI 005 if this resolves the issues. [455:1-] At the end of that subclause (immediately before 15.4 C descriptors) insert the following note: "NOTE 15.22a The requirements on the Fortran processor when a discontiguous actual argument is being passed to a simply contiguous dummy argument are such that the C programmer has the same functionality (and safety) as the Fortran programmer, when either the calling or called procedure are Fortran procedures. The requirements on the C procedure, in the case when both the called and calling procedure are C procedures, effectively require that the C procedure not access memory through the descriptor that is not described by the descriptor; otherwise the program will not conform to the Fortran standard. A dummy argument is simply contiguous if it has the CONTIGUOUS attribute or is an array that is not assumed-shape, assumed-rank, or a pointer.". ===END===