To: J3 J3/24-173 From: Malcolm Cohen Subject: Formal Requirements US25 complex/real association Date: 2024-October-21 Reference: 24-129 1. Introduction Paper 24-129 suggests allowing real array pointers to complex targets, and complex pointers to real array targets. US-25 itself is more vague, just mentioning association. This paper specifies formal requirements. 2. Possible technical issues (a) Array vs. scalar When the pre-existing entity (e.g. target) is a two-element real array, the associating entity (e.g. pointer) could be scalar or could be an array. This just seems weird and inconsistent. I guess that's not a technical issue in itself. It might be a technical issue if we allow argument association, as it would make generics ambiguous. Similarly in reverse. (b) Ranks There are two common schemes for handling complex as real arrays: (1) the real array is one rank higher, with a first dimension size of two; (2) the real array is the same rank, and the first dimension is twice the size of the complex array (this is most common with vectors). These are both in common use, though the original proposer uses (2). For REAL shape [4,3], the COMPLEX shape would be [2,3]; it is far less obvious what the COMPLEX shape should be for REAL shape [3,4]. The obvious solution is to require the pointer assignment to be rank remapping. I note that in the REAL pointer to COMPLEX case, scheme (1) would not necessitate contiguity. However, this seems rather fragile, so should probably not be pursued. (c) Error detection Currently, virtually all pf the association situations would be errors. We should not inhibit future error detection more than necessary. Thus, limiting it to pointer association, and in particular to rank- remapping pointer association, would be an obvious way to minimise the impact of this feature on error detection. 3. Formal Requirements (25R-1) That a pointer of type complex may be associated with a target array of type real. (25R-2) That a pointer of type real may be associated with a target that is of type complex. (25R-3) That no other association between real or complex is permitted, beyond that already provided by storage association. This is to maintain existing error detection capabilities. (25R-4) That the target of such association must have suitable properties, and that as far as possible, this should be checkable at compile time. For example, requiring "simply contiguous" is better than merely requiring "contiguous", as the latter is a runtime check. (25R-5) As the shape of the pointer and target are necessarily different, some means must be used to ensure that the "right thing" happens. For example, rank remapping could be required. ===END===