<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 - /opt/local/libexec/llvm-4.0/include/c++/v1/algorithm:3010:35: runtime error: signed integer overflow: 9223372036854775807 - -9223372036854775808 cannot be represented in type 'long long'"
   href="https://bugs.llvm.org/show_bug.cgi?id=32617">32617</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>/opt/local/libexec/llvm-4.0/include/c++/v1/algorithm:3010:35: runtime error: signed integer overflow: 9223372036854775807 - -9223372036854775808 cannot be represented in type 'long long'
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>4.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>System Library
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>vincent.lebourlot@starqube.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>UBSan detected a bug in algorithm:

/opt/local/libexec/llvm-4.0/bin/../include/c++/v1/algorithm:3010:35: runtime
error: signed integer overflow: 9223372036854775807 - -9223372036854775808
cannot be represented in type 'long long'

I personally patched the line on my machine with: 
    const _UIntType _Rp = _UIntType(__p.b()) - _UIntType(__p.a()) +
_UIntType(1);

which got it working.

this bug can be reproduced by doing: 

std::mt19937_64 engine;   
std::uniform_int_distribution<long long>dist(std::numeric_limits<long
long>::min(), std::numeric_limits<long long>::max());
dist(engine);

cheers
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>