J3/14-240 To: J3 Subject: Interpretation concerning variable definition context From: Van Snyder Date: 2014 October 02 References: 10-007r1, 14-136r1 14-136r1 was submitted as a work item at meeting 204. It was decided that it ought to be processed as an interpretation. 14-136r1 addressed only the case of a subobject of an associate name in a SELECT TYPE or ASSOCIATE construct, but the problem is broader. ---------------------------------------------------------------------- NUMBER: TBD TITLE: Subobject of variable in variable definition context KEYWORD: subobject, variable definition context DEFECT TYPE: Error STATUS: J3 consideration in progress QUESTION: Does this program conform to the Fortran 2008 standard? type :: T integer :: C end type T type(t), parameter :: V = T(41) character(len=*), parameter :: Z = ['first ', 'second'] associate ( W => V ) 1 w%c = 42 end associate 2 v%c = 42 3 read * v%c 4 write ( z(1), '(i0)', iostat=v%c ) 42 end ANSWER: According to 16.6.7p1(13), A appears in a variable definition context if it is (among other things), the in an assignment statement, the in a read statement, the in a , or the in a SELECT TYPE or ASSOCIATE construct and the associate name of that construct appears in a variable definition context. This does not include the case that if a subobject of the variable appears in a variable definition context, the variable is considered to have appeared in a variable definition context. Therefore, V is not considered to have appeared in a variable definition context in statements 1-4, Z is not considered to have appeared in a variable definition context in statement 4, and the program conforms to the Fortran 2008 standard. V ought to have been considered to have appeared in a variable definition context in statements 1-4, Z ought to have been considered to have appeared in a variable definition context in statement 4, and the program ought not to conform to the Fortran 2008 standard. Edits are provided to remedy this oversight. EDITS: [457:13+ 16.6.7p1(13)+] Insert a list item: "(13a) a subobject of the variable appears in a variable definition context;" When it's integrated into the standard: [somewhere in a subclause of 1.6 dealing with Fortran 2008 compatibility] "o The appearance of a subobject of a variable in a variable definition context now results in the variable being considered to have appeared in a variable definition context." SUBMITTED BY: Van Snyder HISTORY: m205 14-nnn Submitted ----------------------------------------------------------------------