<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Possible bug in std::sort"
   href="https://bugs.llvm.org/show_bug.cgi?id=47903">47903</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Possible bug in std::sort
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>10.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </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>alexandru.croitor@qt.io
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=24076" name="attach_24076" title="std::sort crash repro">attachment 24076</a> <a href="attachment.cgi?id=24076&action=edit" title="std::sort crash repro">[details]</a></span>
std::sort crash repro

Hi, I may? have found a bug in libc++'s std::sort() that causes a craash.

I didn't dig too deep except for creating a minimal repro.

Stumbled upon this as part of a bigger project (Qt Creator), but reduced it to
the code in the attachment.

Reproduced it on macOS 10.15.7 + Xcode 11.6 Build version 11E708 

As well as Ubuntu 18.04 clang 10.0.0 (unpackaged from releases.llvm.org) + a
self-built libc++ from git master ( 86ef379800162e5d6bb0d478c5bfb4b56498a272 )

building with the following script

 $ cat make.sh
 #!/bin/sh -x

 export PREFIX=/home/alex/Dev/llvm-project/build/installed
 export CLANG_PREFIX=/home/alex/Dev/clang10/bin
 export CFLAGS="-nostdinc++ -I$PREFIX/include/c++/v1"
 export LFLAGS="-L$PREFIX/lib -Wl,-rpath,$PREFIX/lib -nostdlib++ -lc++"
 $CLANG_PREFIX/clang++ -c -pipe $CFLAGS -O2 -std=gnu++11 -Wall -Wextra -o
main.o ../main.cpp
 $CLANG_PREFIX/clang++ -ccc-gcc-name g++ $LFLAGS -o proj main.o -v</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>