J3/03-118 To: J3 From: UK Fortran panel Subject: Edits for UK comment TC10 (Allocatable array assignment) Date: 11 February 2003 Comment TC10 of the UK vote was: Treat the assignment to an allocatable array in the same way as to an allocatable array component Allocatable array assignment should be user-friendly the same way that allocatable component assignment is; that is, the destination array should be reallocated to the correct shape if it is of the incorrect shape. Thus, instead of having to say: DEALLOCATE (A) ALLOCATE (A(SIZE(COMPRESS(B)))) A = COMPRESS(B) one should be able to say A = COMPRESS(B) and have the same effect (except that if A has the TARGET attribute and is already the same size as B, it should be reused rather than go through the allocate-deallocate cycle - for compatibility with F90/95). For consistency, the above should apply to allocatable scalars (with deferred type parameters) as well as to allocatable arrays. I.e. Treat the assignment to an allocatable variable in the same way as to an allocatable component. Allocatable variable assignment should be user-friendly the same way that allocatable component assignment is; that is, a destination array should be reallocated to the correct shape if it is of the incorrect shape, and if the destination has deferred type parameters, it should be reallocated to have the correct values. A scalar example is that for CHARACTER(:),ALLOCATABLE :: A,B instead of DEALLOCATE(A) ALLOCATE(CHARACTER(LEN(B))::A) A = B one should be able to say A = B and have the same effect. Here are the edits for this: 139:7. Replace the line by (2) Either shall be an allocatable array of the same rank as or the shapes of and shall conform, and 139:9+7. Last line of Table 7.8. Add "kind" before "type parameters". and after "" add "; each nonkind type parameter value shall be the same unless is allocatable and the corresponding type parameter is deferred" {NOTE: "nonkind" should probably be "length" or whatever else is decided.} 139:28+. Add paragraph: If is an allocated allocatable variable, it is deallocated if is an array of different shape or any of the corresponding nonkind type parameter values of and differ. If is or becomes an unallocated allocatable variable, it is allocated with the dynamic type and type parameters of , the shape of , and with each lower bound (if any) equal to the corresponding element of LBOUND().