To: J3 07-297 From: Jim Xia Subject: Interpretation: Evaluation of bound-expr in data pointer assignment Date: 2007 October 11 NUMBER: F03/ TITLE: Evaluation of bound-expr in data pointer assignment KEYWORDS: pointer, pointer assignment, bounds, expression DEFECT TYPE: Error STATUS: Erratum DISCUSSION Currently there are no rules in 7.4.2.1 to prohibit changing of a pointer's association status during evaluation of bound expressions in a data pointer assignment (pointer with either bounds-spec or bounds-remapping specified). This may lead to ambiguous code with regard to the evaluation orders between the bound expression and the data pointer assignment itself. Consider the following code, integer, target :: tar2(100, 100) integer, target :: tar1(100) integer, pointer :: ptr(:,:) ptr(-2:, f1(ptr, tar1, 1, 1):) => tar2 print*, lbound(ptr) print*, ubound(ptr) print*, size(ptr) contains function f1(ptr, arr, i, j) integer :: i, j, f1 integer, pointer :: ptr(:, :) integer, target :: arr(:) ptr (i:j, i:j) => arr f1 = -1 end function end In 7.4.1.3 for interpretation of intrinsic assignments, there are rules explicitly requesting evaluation of all expressions in variable occurred before the variable is defined [139:14-19]. It appears that data point assignment should also follow similar rules. Note the similar problem also exists for evaluating the if it references a function that returns a data pointer. QUESTION: (a) Is this program intended to be standard conforming? (b) If it is standard conforming, then what would it print? ANSWER: (a) Yes, this program is standard conforming. (b) The function f1 is evaluated before the data pointer assignment occurs. The execution of the program should print the following -2 -1 97 98 10000 Edits are provided to clarify this. EDITS: [144:8+] The execution of the data pointer assignment shall have the same effect as if the evaluation of and the evaluation of all expressions in or occurred before the becomes associated with the . None of the evaluations shall either affects or be affected by any other evaluation. SUBMITTED BY: Jim Xia HISTORY: m182 Submitted