Changeset: 4c86bd8551bf for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4c86bd8551bf
Modified Files:
        gdk/gdk_ssort_impl.h
Branch: Jul2015
Log Message:

Port changeset https://hg.python.org/cpython/rev/620cb13008b7.
This fixes the problem noted in de Gouw, Stijn and Rot, Jurriaan and
de Boer, Frank S and Bubel, Richard and Hähnle, Reiner "OpenJDK’s
java.utils.Collection.sort() is broken: The good, the bad and the
worst case".
Also see http://bugs.python.org/23515.


diffs (16 lines):

diff --git a/gdk/gdk_ssort_impl.h b/gdk/gdk_ssort_impl.h
--- a/gdk/gdk_ssort_impl.h
+++ b/gdk/gdk_ssort_impl.h
@@ -749,8 +749,10 @@ do_ssort(MergeState *ms, ssize_t nremain
                        while (ms->n > 1) {
                                ssize_t i = ms->n - 2;
 
-                               if (i > 0 &&
-                                   p[i - 1].len <= p[i].len + p[i + 1].len) {
+                               if ((i > 0 &&
+                                    p[i-1].len <= p[i].len + p[i+1].len) ||
+                                   (i > 1 &&
+                                    p[i-2].len <= p[i-1].len + p[i].len)) {
                                        if (p[i - 1].len < p[i + 1].len)
                                                --i;
                                        if (merge_at(ms, i) < 0)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to