include/comphelper/parallelsort.hxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b8e451af93c2917d70214c75bb6b6a8bf566813b
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Wed Jun 29 15:59:47 2022 +0200
Commit:     Stephan Bergmann <[email protected]>
CommitDate: Tue Aug 9 09:37:03 2022 +0200

    Use stable_sort in comphelper::s3sort
    
    With a randomizing debug-mode libc++ (`export 
LIBCPP_DEBUG=-D_LIBCPP_DEBUG=1`
    in config_host.mk), CppunitTest_sc_ucalc_pivottable consistently failed for 
me
    with
    
    > Expected: A  Actual: a
    > 
sc/qa/unit/ucalc_pivottable.cxx:1886:TestPivottable::testPivotTableCaseInsensitiveStrings
    > assertion failed
    > - Expression: bSuccess
    > - Table output check failed
    
    when _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY_SEED is 140365334480272.
    
    This change apparently happens to fix it, but I have no idea what exactly is
    going on here.  (comphelper::s3sort was introduced in
    46d0afba738d8ee7c9b63384fef513f42ee587f3 "Implement parallel version of
    super-scalar-sample-sort...", and
    TestPivottable::testPivotTableCaseInsensitiveStrings traces back to
    96086484d3429ff849b468ef5d1ff8ac8e7874a9 "Move pivot table tests into a 
separate
    source file.)
    
    Change-Id: I24316db6cb274f7afd0ce0a5aa9ced79121eeeb8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136623
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <[email protected]>

diff --git a/include/comphelper/parallelsort.hxx 
b/include/comphelper/parallelsort.hxx
index 94d86e0d119b..032165f06f0c 100644
--- a/include/comphelper/parallelsort.hxx
+++ b/include/comphelper/parallelsort.hxx
@@ -292,7 +292,7 @@ void s3sort(const RandItr aBegin, const RandItr aEnd, 
Compare aComp = Compare(),
     const std::size_t nLen = static_cast<std::size_t>(aEnd - aBegin);
     if (nLen < nBaseCaseSize)
     {
-        std::sort(aBegin, aEnd, aComp);
+        std::stable_sort(aBegin, aEnd, aComp);
         return;
     }
 

Reply via email to