11-163 To: J3 From: Nick Maclaren Subject: Interop TR: the version member Date: 2011 June 07 Reference: N1854 There is a lack of clarity about when the version member is set, and this is particularly serious to do with CFI_section and CFI_select_part, which can be used on either new or existing descriptors but which have no way of telling which they have! The problem affects ONLY pointers, and is with code like: SUBROUTINE Fred (arg) BIND(C) INTEGER, POINTER, DIMENSION(:,:,:), INTENT(OUT) :: arg END SUBROUTINE Fred INTEGER, POINTER, DIMENSION(:,:,:) :: ptr CALL Fred(arg) The Fortran code may well get back a descriptor that has a newer version than it created the pointer with. In itself, that does not matter, but it handicap when using the version for extensions. There are a couple of reasonable options. Option 1: We specify that the version member is set on establishment (i.e. always by CFI_establish, CFI_section and CFI_select_part, and never by other calls). That is clear and simple. Option 2: We require that CFI_establish is called before CFI_section and CFI_select_part, and simplify those by removing the arguments that will then not be needed. On the grounds of minimal change, I propose the first. Edits to N1854: [10:7] Append "when the descriptor is established and otherwise not changed."