Today I found a fault(maybe?) of fpc 3.0.4 when I was solving an ACM problem.
I uses TOrderingArrayUtils to Sort an TVector,but it turns to RunTimeError at times.Then I view the source of garrayutils.pp on github.
while (cur <> 0) AND (TCompare.c(Arr[l],Arr[cur])) do begin temp:=Arr[cur]; Arr[cur]:=Arr[l]; Arr[l]:=temp; cur:=l; l:=Parent(cur-Start)+Start; end;
I think theshould be
cur <> 0.Otherwise it will access a wrong position of the heap because (cur-Start) doesn't have a Parent.
cur > Start
But I'm not sure.Can anyone prove it and contact the authority?