code generation for returning dynamic array