<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - std::stable_sort exceeds maximum complexity defined by c++11 standard"
href="https://llvm.org/bugs/show_bug.cgi?id=26886">26886</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>std::stable_sort exceeds maximum complexity defined by c++11 standard
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>3.8
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ionelpopescu97@yahoo.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=16014" name="attach_16014" title="stable_sort.cpp">attachment 16014</a> <a href="attachment.cgi?id=16014&action=edit" title="stable_sort.cpp">[details]</a></span>
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
###############################################################################</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>