[llvm-bugs] [Bug 38469] New: Incorrect mersenne_twister_engine equality comparison on initial seed states

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 7 07:05:27 PDT 2018


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

            Bug ID: 38469
           Summary: Incorrect mersenne_twister_engine equality comparison
                    on initial seed states
           Product: libc++
           Version: 7.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hstong at ca.ibm.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

Created attachment 20654
  --> https://bugs.llvm.org/attachment.cgi?id=20654&action=edit
Program as described in the Description

[rand.req.eng] specifies the comparison between two engines as returning true
if the infinite sequences of values that would be generated by repeated calls
to their respective operator()s are equivalent.

The attached program seeds two mersenne_twister_engines with specific states.
It asserts that the values returned by the engines match for some number of
calls, and that the engines are considered equivalent after that set of calls.

It then asserts that the engines were equivalent before those calls.
The assertion fails; however, either an earlier assertion should have failed,
or the engines before those calls do indeed produce equivalent infinite
sequences of values.

Online compiler: https://wandbox.org/permlink/a3frEvZRLgezujN1


=== COMPILER INVOCATION:
clang++ -stdlib=libc++ -std=c++17 -pedantic-errors -Wall -Wextra -Werror -xc++
mteEqSeededStates.cc -o ./a.out


=== RUN SCRIPT:
./a.out


=== EXPECTED RUN OUTPUT:
(Exits with rc=0).


=== ACTUAL RUN OUTPUT:
a.out: mteEqSeededStates.cc:74: int main(): Assertion
`enginesCompareEqualOnInit' failed.


=== COMPILER VERSION INFO (clang++ -v):
clang version 8.0.0 (https://github.com/llvm-mirror/clang.git
074cccc152df061007c8500515698b57a5af7103)
(https://github.com/llvm-mirror/llvm.git
40868d437198d20a353ce4f4fb114b4d33efe5aa)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/wandbox/clang-head/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Selected multilib: .;@m64

-- 
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/20180807/6f487dad/attachment.html>


More information about the llvm-bugs mailing list