C.11.4 Pointers and targets as arguments
If a nonpointer dummy argument has the TARGET attribute and the corresponding actual argument does not, any pointers that become associated with the dummy argument, and therefore with the actual argument, during execution of the procedure, become undefined when execution of the procedure completes.
In your code, there is a possibility (e.g. if ARRAY%N = -10) that DATA remains undefined at function end. There is no “association status” of the function result when it is used for its value. If the function result is used in pointer context (e.g. VIEW(X) = TGT), and provided the IF statement did not fall through, then I think this will be conforming. However, any other POINTER that was associated, during VIEW, with the dummy ARRAY, will be undefined after VIEW terminates, if the actual argument was not a TARGET.