On Mon, 4 Feb 2019 14:26:55 +0200
Nikolay Nikolov <nick...@gmail.com> wrote:

> On 2/3/19 11:22 PM, C Western wrote:
> > I suspect the new sorting routines need some work - lazarus
> > compiled with the latest trunk hangs on start up, and it looks like
> > an infinite loop in sorting. Stack trace below.  
> 
> Even though the sort routine did slightly change, I believe this
> exposes a bug in lazarus. The CompareBinary routine in
> syneditmarkuphighall.pp returns -1 when the strings are equal, while
> it should return 0 in this case. This is like having two elements in
> the array, for which (a<b) and (b<a) are both true at the same time.
> The Compare function, passed to the sort algorithms must satisfy the
> mathematical properties of comparisons, otherwise the result is
> undefined (whether it should results in a hang (like in this case),
> or in a bad sort (like in the previous variation of the algorithm) is
> a separate discussion).
> 
> The attached patch fixes this.

Thanks. Applied.

Mattias
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to