[ 0:01] compiling /home/xrockai/src/divine/nightly/test/libcxx/algorithms/sample.pass.cpp [ 0:01] In file included from /home/xrockai/src/divine/nightly/test/libcxx/algorithms/sample.pass.cpp:22: [ 0:01] In file included from /dios/libcxx/include/algorithm:639: [ 0:01] In file included from /dios/libcxx/include/initializer_list:46: [ 0:01] In file included from /dios/libcxx/include/cstddef:44: [ 0:01] In file included from /dios/include/stddef.h:10: [ 0:01] In file included from /dios/include/_PDCLIB/int.h:16: [ 0:01] /dios/include/_PDCLIB/cdefs.h:69:10: warning: Unsupported _ _cplusplus (__cplusplus) (too new) (supported: ISO/IEC 14882:1997, ISO/IEC 14882:2011). [ 0:01] #warning Unsupported _ _cplusplus (__cplusplus) (too new) (supported: ISO/IEC 14882:1997, ISO/IEC 14882:2011). [ 0:01] ^ [ 0:01] 1 warning generated. [ 0:03] compiling /dios/lib/config/seqklee.bc [ 0:03] setting up pass: functionmeta, options = [ 0:04] setting up pass: fuse-ctors, options = [ 0:04] KLEE: output directory is "/var/obj/divine-nightly/semidbg/test/__test_work_dir.13/_klee_out" [ 0:07] KLEE: Using Z3 solver backend [ 0:07] WARNING: this target does not support the llvm.stacksave intrinsic. [ 0:07] warning: Linking two modules of different target triples: klee_div_zero_check.bc' is 'x86_64-unknown-linux-gnu' whereas 'klee.bc' is 'x86_64-unknown-none-elf' [ 0:07] [ 0:07] KLEE: WARNING: undefined reference to function: __dios_tainted_init [ 0:10] KLEE: WARNING: undefined reference to function: klee_free [ 0:10] KLEE: WARNING: undefined reference to function: klee_malloc [ 0:10] i:1 [ 0:10] KLEE: WARNING ONCE: Alignment of memory from call "klee_malloc" is not modelled. Using alignment of 8. [ 0:10] about to __boot:0 [ 0:10] about to run the scheduler:0 [ 0:10] KLEE: WARNING ONCE: calling external: __dios_tainted_init() at /dios/libc/sys/start.cpp:49 5 [ 0:10] KLEE: ERROR: /dios/libc/sys/start.cpp:87: failed external call: __dios_tainted_init [ 0:10] KLEE: NOTE: now ignoring this error at this location [ 0:10] KLEE: ERROR: EXITING ON ERROR: [ 0:10] Error: failed external call: __dios_tainted_init [ 0:10] File: /dios/libc/sys/start.cpp [ 0:10] Line: 87 [ 0:10] assembly.ll line: 45667 [ 0:10] Stack: [ 0:10] #000045667 in __dios_start (l=2, argc=1, argv=94662942339592, envp=94662942408712) at /dios/libc/sys/start.cpp:87 [ 0:10] #100021676 in _ZN6__dios10sched_nullINS_5ClockINS_10NondetKleeINS_4BaseEEEEEE13run_schedulerINS_7ContextEEEvv () at /dios/sys/sched_null.hpp:163 [ 0:10] #200053915 in klee_boot (argc=2, argv=94662913710848) at /dios/arch/klee/boot.c:41 [ 0:10] [ 0:10] [ 0:10] 1 /* TAGS: c++ fin */ [ 0:10] 2 /* CC_OPTS: -std=c++2a */ [ 0:10] 3 /* VERIFY_OPTS: -o nofail:malloc */ [ 0:10] 4 //===----------------------------------------------------------------------===// [ 0:10] 5 // [ 0:10] 6 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. [ 0:10] 7 // See https://llvm.org/LICENSE.txt for license information. [ 0:10] 8 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception [ 0:10] 9 // [ 0:10] 10 //===----------------------------------------------------------------------===// [ 0:10] 11 [ 0:10] 12 // UNSUPPORTED: c++98, c++03, c++11, c++14 [ 0:10] 13 [ 0:10] 14 // [ 0:10] 15 [ 0:10] 16 // template [ 0:10] 18 // SampleIterator sample(PopulationIterator first, PopulationIterator last, [ 0:10] 19 // SampleIterator out, Distance n, [ 0:10] 20 // UniformRandomNumberGenerator &&g); [ 0:10] 21 [ 0:10] 22 #include [ 0:10] 23 #include [ 0:10] 24 #include [ 0:10] 25 #include [ 0:10] 26 #include [ 0:10] 27 [ 0:10] 28 #include "test_iterators.h" [ 0:10] 29 #include "test_macros.h" [ 0:10] 30 [ 0:10] 31 struct ReservoirSampleExpectations { [ 0:10] 32 enum { os = 4 }; [ 0:10] 33 static int oa1[os]; [ 0:10] 34 static int oa2[os]; [ 0:10] 35 }; [ 0:10] 36 [ 0:10] 37 int ReservoirSampleExpectations::oa1[] = {10, 5, 9, 4}; [ 0:10] 38 int ReservoirSampleExpectations::oa2[] = {5, 2, 10, 4}; [ 0:10] 39 [ 0:10] 40 struct SelectionSampleExpectations { [ 0:10] 41 enum { os = 4 }; [ 0:10] 42 static int oa1[os]; [ 0:10] 43 static int oa2[os]; [ 0:10] 44 }; [ 0:10] 45 [ 0:10] 46 int SelectionSampleExpectations::oa1[] = {1, 4, 6, 7}; [ 0:10] 47 int SelectionSampleExpectations::oa2[] = {1, 2, 6, 8}; [ 0:10] 48 [ 0:10] 49 template struct TestExpectations [ 0:10] 50 : public SelectionSampleExpectations {}; [ 0:10] 51 [ 0:10] 52 template <> [ 0:10] 53 struct TestExpectations [ 0:10] 54 : public ReservoirSampleExpectations {}; [ 0:10] 55 [ 0:10] 56 template class PopulationIteratorType, class PopulationItem, [ 0:10] 57 template class SampleIteratorType, class SampleItem> [ 0:10] 58 void test() { [ 0:10] 59 typedef PopulationIteratorType PopulationIterator; [ 0:10] 60 typedef SampleIteratorType SampleIterator; [ 0:10] 61 PopulationItem ia[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; [ 0:10] 62 const unsigned is = sizeof(ia) / sizeof(ia[0]); [ 0:10] 63 typedef TestExpectations::iterator_category> Expectations; [ 0:10] 65 const unsigned os = Expectations::os; [ 0:10] 66 SampleItem oa[os]; [ 0:10] 67 const int *oa1 = Expectations::oa1; [ 0:10] 68 ((void)oa1); // Prevent unused warning [ 0:10] 69 const int *oa2 = Expectations::oa2; [ 0:10] 70 ((void)oa2); // Prevent unused warning [ 0:10] 71 std::minstd_rand g; [ 0:10] 72 SampleIterator end; [ 0:10] 73 end = std::sample(PopulationIterator(ia), [ 0:10] 74 PopulationIterator(ia + is), [ 0:10] 75 SampleIterator(oa), os, g); [ 0:10] 76 assert(static_cast(end.base() - oa) == std::min(os, is)); [ 0:10] 77 // sample() is deterministic but non-reproducible; [ 0:10] 78 // its results can vary between implementations. [ 0:10] 79 LIBCPP_ASSERT(std::equal(oa, oa + os, oa1)); [ 0:10] 80 end = std::sample(PopulationIterator(ia), [ 0:10] 81 PopulationIterator(ia + is), [ 0:10] 82 SampleIterator(oa), os, std::move(g)); [ 0:10] 83 assert(static_cast(end.base() - oa) == std::min(os, is)); [ 0:10] 84 LIBCPP_ASSERT(std::equal(oa, oa + os, oa2)); [ 0:10] 85 } [ 0:10] 86 [ 0:10] 87 template class PopulationIteratorType, class PopulationItem, [ 0:10] 88 template class SampleIteratorType, class SampleItem> [ 0:10] 89 void test_empty_population() { [ 0:10] 90 typedef PopulationIteratorType PopulationIterator; [ 0:10] 91 typedef SampleIteratorType SampleIterator; [ 0:10] 92 PopulationItem ia[] = {42}; [ 0:10] 93 const unsigned os = 4; [ 0:10] 94 SampleItem oa[os]; [ 0:10] 95 std::minstd_rand g; [ 0:10] 96 SampleIterator end = [ 0:10] 97 std::sample(PopulationIterator(ia), PopulationIterator(ia), [ 0:10] 98 SampleIterator(oa), os, g); [ 0:10] 99 assert(end.base() == oa); [ 0:10] 100 } [ 0:10] 101 [ 0:10] 102 template class PopulationIteratorType, class PopulationItem, [ 0:10] 103 template class SampleIteratorType, class SampleItem> [ 0:10] 104 void test_empty_sample() { [ 0:10] 105 typedef PopulationIteratorType PopulationIterator; [ 0:10] 106 typedef SampleIteratorType SampleIterator; [ 0:10] 107 PopulationItem ia[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; [ 0:10] 108 const unsigned is = sizeof(ia) / sizeof(ia[0]); [ 0:10] 109 SampleItem oa[1]; [ 0:10] 110 std::minstd_rand g; [ 0:10] 111 SampleIterator end = [ 0:10] 112 std::sample(PopulationIterator(ia), PopulationIterator(ia + is), [ 0:10] 113 SampleIterator(oa), 0, g); [ 0:10] 114 assert(end.base() == oa); [ 0:10] 115 } [ 0:10] 116 [ 0:10] 117 template class PopulationIteratorType, class PopulationItem, [ 0:10] 118 template class SampleIteratorType, class SampleItem> [ 0:10] 119 void test_small_population() { [ 0:10] 120 // The population size is less than the sample size. [ 0:10] 121 typedef PopulationIteratorType PopulationIterator; [ 0:10] 122 typedef SampleIteratorType SampleIterator; [ 0:10] 123 PopulationItem ia[] = {1, 2, 3, 4, 5}; [ 0:10] 124 const unsigned is = sizeof(ia) / sizeof(ia[0]); [ 0:10] 125 const unsigned os = 8; [ 0:10] 126 SampleItem oa[os]; [ 0:10] 127 const SampleItem oa1[] = {1, 2, 3, 4, 5}; [ 0:10] 128 std::minstd_rand g; [ 0:10] 129 SampleIterator end; [ 0:10] 130 end = std::sample(PopulationIterator(ia), [ 0:10] 131 PopulationIterator(ia + is), [ 0:10] 132 SampleIterator(oa), os, g); [ 0:10] 133 assert(static_cast(end.base() - oa) == std::min(os, is)); [ 0:10] 134 typedef typename std::iterator_traits::iterator_category PopulationCategory; [ 0:10] 135 if (std::is_base_of::value) { [ 0:10] 136 assert(std::equal(oa, end.base(), oa1)); [ 0:10] 137 } else { [ 0:10] 138 assert(std::is_permutation(oa, end.base(), oa1)); [ 0:10] 139 } [ 0:10] 140 } [ 0:10] 141 [ 0:10] 142 int main(int, char**) { [ 0:10] 143 test(); [ 0:10] 144 test(); [ 0:10] 145 test(); [ 0:10] 146 [ 0:10] 147 test(); [ 0:10] 148 test(); [ 0:10] 149 test(); [ 0:10] 150 [ 0:10] 151 test_empty_population(); [ 0:10] 152 test_empty_population(); [ 0:10] 153 test_empty_population(); [ 0:10] 154 [ 0:10] 155 test_empty_sample(); [ 0:10] 156 test_empty_sample(); [ 0:10] 157 test_empty_sample(); [ 0:10] 158 [ 0:10] 159 test_small_population(); [ 0:10] 160 test_small_population(); [ 0:10] 161 test_small_population(); [ 0:10] 162 [ 0:10] 163 return 0; [ 0:10] 164 } [ 0:10] # no errors were expected but one was found anyway