https://llvm.org/bugs/show_bug.cgi?id=26886

            Bug ID: 26886
           Summary: std::stable_sort exceeds maximum complexity defined by
                    c++11 standard
           Product: libc++
           Version: 3.8
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: ionelpopesc...@yahoo.com
                CC: llvm-bugs@lists.llvm.org, mclow.li...@gmail.com
    Classification: Unclassified

Created attachment 16014
  --> https://llvm.org/bugs/attachment.cgi?id=16014&action=edit
stable_sort.cpp

std::stable_sort exceeds the maximum complexity when the Compare function
object is based on a "greater than" relation.
I attached a sample test to reproduce the problem.

Also, here is a comparison of the complexity obtained for other libraries.

###############################################################################
#Linux clang libc++
ipopescu@ipopescu:~/work/test$ clang++ -stdlib=libc++ test.cpp -lc++abi
-std=c++11 -o test
ipopescu@ipopescu:~/work/test$ ./test
cmpLess=19
cmpGt=190
test: test.cpp:35: int main(): Assertion `cnt <= N * logN * logN' failed.
Aborted (core dumped)

###############################################################################
#Linux GCC libstdc++11
ipopescu@ipopescu:~/work/test$ gcc test.cpp -o test -lstdc++ -std=c++11 -g
ipopescu@ipopescu:~/work/test$ ./test
cmpLess=56
cmpGt=32

###############################################################################
#Windows
C:\Users\ipopescu\Documents\Visual Studio 2015\Projects\test\x64\Debug>test.exe
cmpLess=38
cmpGt=38

###############################################################################

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to