[llvm-bugs] [Bug 34160] New: Unsigned integer over in std::mt19937 when using 0 as a seed

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Aug 11 10:54:23 PDT 2017


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

            Bug ID: 34160
           Summary: Unsigned integer over in std::mt19937 when using 0 as
                    a seed
           Product: libc++
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: yaghmour.shafik at gmail.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

The following program

#include <random>

int main() {
 std::mt19937 instance(0) ;   
}

when build using the following command line:

clang++ -std=c++14 -fsanitize=address -fsanitize=undefined,integer

and then run produces the following diagnostic:

random:2312:26: runtime error: unsigned integer overflow: 1812433253 *
1812433254 cannot be represented in type 'unsigned int'

Being unsigned overflow this is not undefined behavior but if this is intended
behavior it would be helpful if it was sanitizer was suppressed, I guess via:

__attribute__((no_sanitize("integer")))

-- 
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/20170811/d03afccb/attachment.html>


More information about the llvm-bugs mailing list