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: unassignedclangb...@nondot.org
          Reporter: yaghmour.sha...@gmail.com
                CC: llvm-bugs@lists.llvm.org, mclow.li...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to