[llvm-bugs] [Bug 26886] New: std::stable_sort exceeds maximum complexity defined by c++11 standard

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 9 05:34:48 PST 2016


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: unassignedclangbugs at nondot.org
          Reporter: ionelpopescu97 at yahoo.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at 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 at ipopescu:~/work/test$ clang++ -stdlib=libc++ test.cpp -lc++abi
-std=c++11 -o test
ipopescu at 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 at ipopescu:~/work/test$ gcc test.cpp -o test -lstdc++ -std=c++11 -g
ipopescu at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160309/76c4ea65/attachment.html>


More information about the llvm-bugs mailing list