procedure fpc_dynarray_setlength(var p : pointer;pti : pointer;
dimcount : sizeint;dims : pdynarrayindex);[Public,Alias:'FPC_DYNARR_SETLENGTH']; compilerproc;
contains the following lines:
...
newp:=getmem(size);
fillchar(newp^,sizeof(tdynarray),0);
...
newp^.refcount:=1;
newp^.high:=dims[0]-1;
...
Because
tdynarray = { packed } record
refcount : ptrint;
high : tdynarrayindex;
end;
the "
fillchar(newp^,sizeof(tdynarray),0);" line is equivalent to "
newp^.refcount:=0;newp^.high:=0;". Later in code we have "
newp^.refcount:=1;newp^.high:=dims[0]-1;" which makes the presence of the fillchar line useless.
The following patch removes the fillchar line.