Incorrect. SetLength either initializes or re-initializes the contents. In short if the argument passed is an already initialized variable it tries to preserve the existing data if possible (ee on expanding but not on shrinking). So yes it requires a proper initialized variable to decide if it needs to preserve existing data or not.
I understand that. However the compiler knows that the function shall return a dynamic array, hence it could as well set implicitly result := nil before the Setlength() call. It does not do so, and that is all but clear.
There are possibly reasons for that behaviour, but this is a rather dangerous construct within a language praised as "safe": You may use setlength(x) anywhere in your code without initialising x, ONLY within a function it goes bonkers. What is the logic of that ?
Related bug report 0030321 already claims this behaviouer is poorly documented; however even if documented, I would find it difficult to accept. The report report says "fixed in 3.1.1" but from Jonas' response to my report 0030321 it is not quite clear if actually the code has been changed, or only the documentation.