[llvm-bugs] [Bug 34663] New: UBSan goes off on uniform_int_distribution
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Sep 18 20:53:38 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=34663
Bug ID: 34663
Summary: UBSan goes off on uniform_int_distribution
Product: libc++
Version: 5.0
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: mclow.lists at gmail.com
CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
ON x86_64 Linux, UBSan complains when the following program is run:
#include <array>
#include <random>
#include <cassert>
uint32_t array[1024 * 1024];
int main () {
std::mt19937 randEngine;
std::uniform_int_distribution<uint32_t> dist;
for (auto &i : array)
i = dist(randEngine);
std::sort(std::begin(array), std::end(array));
assert(std::is_sorted(std::begin(array), std::end(array)));
}
in particular, it doesn't like the line <algorithm>:3025.
This does no occur on Mac OS. BUT, if you change the `randEngine` declaration
to
std::mersenne_twister_engine<unsigned long, 32ul, 624ul, 397ul, 31ul,
2567483615ul, 11ul, 4294967295ul, 7ul, 2636928640ul, 15ul, 4022730752ul, 18ul,
1812433253ul> randEngine;
then UBSan will fire on Mac OS as well.
--
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/20170919/6f01e6f3/attachment.html>
More information about the llvm-bugs
mailing list