[llvm-bugs] [Bug 32617] 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'

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Apr 11 00:32:54 PDT 2017


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

            Bug ID: 32617
           Summary: /opt/local/libexec/llvm-4.0/include/c++/v1/algorithm:3
                    010:35: runtime error: signed integer overflow:
                    9223372036854775807 - -9223372036854775808 cannot be
                    represented in type 'long long'
           Product: libraries
           Version: 4.0
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: System Library
          Assignee: unassignedbugs at nondot.org
          Reporter: vincent.lebourlot at starqube.com
                CC: llvm-bugs at lists.llvm.org

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.

-- 
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/20170411/3f1339b1/attachment-0001.html>


More information about the llvm-bugs mailing list