[ 0:01] compiling /home/xrockai/src/divine/nightly/test/libcxx/algorithms/unique_pred.pass.cpp [ 0:01] In file included from /home/xrockai/src/divine/nightly/test/libcxx/algorithms/unique_pred.pass.cpp:20: [ 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:02] compiling /dios/lib/config/seqklee.bc [ 0:02] 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:08] KLEE: Using Z3 solver backend [ 0:08] WARNING: this target does not support the llvm.stacksave intrinsic. [ 0:08] 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:09] [ 0:09] KLEE: WARNING: undefined reference to function: _Z10klee_abortv [ 0:15] KLEE: WARNING: undefined reference to function: __dios_tainted_init [ 0:15] KLEE: WARNING: undefined reference to function: klee_free [ 0:15] KLEE: WARNING: undefined reference to function: klee_malloc [ 0:15] KLEE: WARNING ONCE: Using zero size array fix for landingpad instruction filter [ 0:15] i:1 [ 0:15] KLEE: WARNING ONCE: Alignment of memory from call "klee_malloc" is not modelled. Using alignment of 8. [ 0:15] about to __boot:0 [ 0:15] about to run the scheduler:0 [ 0:15] KLEE: WARNING ONCE: calling external: __dios_tainted_init() at /dios/libc/sys/start.cpp:49 5 [ 0:15] KLEE: ERROR: /dios/libc/sys/start.cpp:87: failed external call: __dios_tainted_init [ 0:15] KLEE: NOTE: now ignoring this error at this location [ 0:15] KLEE: ERROR: EXITING ON ERROR: [ 0:15] Error: failed external call: __dios_tainted_init [ 0:15] File: /dios/libc/sys/start.cpp [ 0:15] Line: 87 [ 0:15] assembly.ll line: 86254 [ 0:15] Stack: [ 0:15] #000086254 in __dios_start (l=2, argc=1, argv=94873237047304, envp=94873237132808) at /dios/libc/sys/start.cpp:87 [ 0:15] #100034256 in _ZN6__dios10sched_nullINS_5ClockINS_10NondetKleeINS_4BaseEEEEEE13run_schedulerINS_7ContextEEEvv () at /dios/sys/sched_null.hpp:163 [ 0:15] #200094834 in klee_boot (argc=2, argv=94873206828416) at /dios/arch/klee/boot.c:41 [ 0:15] [ 0:15] [ 0:15] 1 /* TAGS: c++ fin */ [ 0:15] 2 /* CC_OPTS: -std=c++2a */ [ 0:15] 3 /* VERIFY_OPTS: -o nofail:malloc */ [ 0:15] 4 //===----------------------------------------------------------------------===// [ 0:15] 5 // [ 0:15] 6 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. [ 0:15] 7 // See https://llvm.org/LICENSE.txt for license information. [ 0:15] 8 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception [ 0:15] 9 // [ 0:15] 10 //===----------------------------------------------------------------------===// [ 0:15] 11 [ 0:15] 12 // [ 0:15] 13 [ 0:15] 14 // template Pred> [ 0:15] 15 // requires OutputIterator::type> [ 0:15] 16 // && CopyConstructible [ 0:15] 17 // constexpr Iter // constexpr after C++17 [ 0:15] 18 // unique(Iter first, Iter last, Pred pred); [ 0:15] 19 [ 0:15] 20 #include [ 0:15] 21 #include [ 0:15] 22 #include [ 0:15] 23 [ 0:15] 24 #include "test_macros.h" [ 0:15] 25 #include "test_iterators.h" [ 0:15] 26 [ 0:15] 27 #if TEST_STD_VER > 17 [ 0:15] 28 TEST_CONSTEXPR bool test_constexpr() { [ 0:15] 29 int ia[] = {0, 1, 1, 3, 4}; [ 0:15] 30 const int expected[] = {0, 1, 3, 4}; [ 0:15] 31 const size_t N = 4; [ 0:15] 32 [ 0:15] 33 auto it = std::unique(std::begin(ia), std::end(ia), [](int a, int b) {return a == b; }); [ 0:15] 34 return it == (std::begin(ia) + N) [ 0:15] 35 && std::equal(std::begin(ia), it, std::begin(expected), std::end(expected)) [ 0:15] 36 ; [ 0:15] 37 } [ 0:15] 38 #endif [ 0:15] 39 [ 0:15] 40 struct count_equal [ 0:15] 41 { [ 0:15] 42 static unsigned count; [ 0:15] 43 template [ 0:15] 44 bool operator()(const T& x, const T& y) [ 0:15] 45 {++count; return x == y;} [ 0:15] 46 }; [ 0:15] 47 [ 0:15] 48 unsigned count_equal::count = 0; [ 0:15] 49 [ 0:15] 50 template [ 0:15] 51 void [ 0:15] 52 test() [ 0:15] 53 { [ 0:15] 54 int ia[] = {0}; [ 0:15] 55 const unsigned sa = sizeof(ia)/sizeof(ia[0]); [ 0:15] 56 count_equal::count = 0; [ 0:15] 57 Iter r = std::unique(Iter(ia), Iter(ia+sa), count_equal()); [ 0:15] 58 assert(base(r) == ia + sa); [ 0:15] 59 assert(ia[0] == 0); [ 0:15] 60 assert(count_equal::count == sa-1); [ 0:15] 61 [ 0:15] 62 int ib[] = {0, 1}; [ 0:15] 63 const unsigned sb = sizeof(ib)/sizeof(ib[0]); [ 0:15] 64 count_equal::count = 0; [ 0:15] 65 r = std::unique(Iter(ib), Iter(ib+sb), count_equal()); [ 0:15] 66 assert(base(r) == ib + sb); [ 0:15] 67 assert(ib[0] == 0); [ 0:15] 68 assert(ib[1] == 1); [ 0:15] 69 assert(count_equal::count == sb-1); [ 0:15] 70 [ 0:15] 71 int ic[] = {0, 0}; [ 0:15] 72 const unsigned sc = sizeof(ic)/sizeof(ic[0]); [ 0:15] 73 count_equal::count = 0; [ 0:15] 74 r = std::unique(Iter(ic), Iter(ic+sc), count_equal()); [ 0:15] 75 assert(base(r) == ic + 1); [ 0:15] 76 assert(ic[0] == 0); [ 0:15] 77 assert(count_equal::count == sc-1); [ 0:15] 78 [ 0:15] 79 int id[] = {0, 0, 1}; [ 0:15] 80 const unsigned sd = sizeof(id)/sizeof(id[0]); [ 0:15] 81 count_equal::count = 0; [ 0:15] 82 r = std::unique(Iter(id), Iter(id+sd), count_equal()); [ 0:15] 83 assert(base(r) == id + 2); [ 0:15] 84 assert(id[0] == 0); [ 0:15] 85 assert(id[1] == 1); [ 0:15] 86 assert(count_equal::count == sd-1); [ 0:15] 87 [ 0:15] 88 int ie[] = {0, 0, 1, 0}; [ 0:15] 89 const unsigned se = sizeof(ie)/sizeof(ie[0]); [ 0:15] 90 count_equal::count = 0; [ 0:15] 91 r = std::unique(Iter(ie), Iter(ie+se), count_equal()); [ 0:15] 92 assert(base(r) == ie + 3); [ 0:15] 93 assert(ie[0] == 0); [ 0:15] 94 assert(ie[1] == 1); [ 0:15] 95 assert(ie[2] == 0); [ 0:15] 96 assert(count_equal::count == se-1); [ 0:15] 97 [ 0:15] 98 int ig[] = {0, 0, 1, 1}; [ 0:15] 99 const unsigned sg = sizeof(ig)/sizeof(ig[0]); [ 0:15] 100 count_equal::count = 0; [ 0:15] 101 r = std::unique(Iter(ig), Iter(ig+sg), count_equal()); [ 0:15] 102 assert(base(r) == ig + 2); [ 0:15] 103 assert(ig[0] == 0); [ 0:15] 104 assert(ig[1] == 1); [ 0:15] 105 assert(count_equal::count == sg-1); [ 0:15] 106 [ 0:15] 107 int ih[] = {0, 1, 1}; [ 0:15] 108 const unsigned sh = sizeof(ih)/sizeof(ih[0]); [ 0:15] 109 count_equal::count = 0; [ 0:15] 110 r = std::unique(Iter(ih), Iter(ih+sh), count_equal()); [ 0:15] 111 assert(base(r) == ih + 2); [ 0:15] 112 assert(ih[0] == 0); [ 0:15] 113 assert(ih[1] == 1); [ 0:15] 114 assert(count_equal::count == sh-1); [ 0:15] 115 [ 0:15] 116 int ii[] = {0, 1, 1, 1, 2, 2, 2}; [ 0:15] 117 const unsigned si = sizeof(ii)/sizeof(ii[0]); [ 0:15] 118 count_equal::count = 0; [ 0:15] 119 r = std::unique(Iter(ii), Iter(ii+si), count_equal()); [ 0:15] 120 assert(base(r) == ii + 3); [ 0:15] 121 assert(ii[0] == 0); [ 0:15] 122 assert(ii[1] == 1); [ 0:15] 123 assert(ii[2] == 2); [ 0:15] 124 assert(count_equal::count == si-1); [ 0:15] 125 } [ 0:15] 126 [ 0:15] 127 #if TEST_STD_VER >= 11 [ 0:15] 128 [ 0:15] 129 struct do_nothing [ 0:15] 130 { [ 0:15] 131 void operator()(void*) const {} [ 0:15] 132 }; [ 0:15] 133 [ 0:15] 134 typedef std::unique_ptr Ptr; [ 0:15] 135 [ 0:15] 136 template [ 0:15] 137 void [ 0:15] 138 test1() [ 0:15] 139 { [ 0:15] 140 int one = 1; [ 0:15] 141 int two = 2; [ 0:15] 142 Ptr ia[1]; [ 0:15] 143 const unsigned sa = sizeof(ia)/sizeof(ia[0]); [ 0:15] 144 count_equal::count = 0; [ 0:15] 145 Iter r = std::unique(Iter(ia), Iter(ia+sa), count_equal()); [ 0:15] 146 assert(base(r) == ia + sa); [ 0:15] 147 assert(ia[0] == 0); [ 0:15] 148 assert(count_equal::count == sa-1); [ 0:15] 149 [ 0:15] 150 Ptr ib[2]; [ 0:15] 151 ib[1].reset(&one); [ 0:15] 152 const unsigned sb = sizeof(ib)/sizeof(ib[0]); [ 0:15] 153 count_equal::count = 0; [ 0:15] 154 r = std::unique(Iter(ib), Iter(ib+sb), count_equal()); [ 0:15] 155 assert(base(r) == ib + sb); [ 0:15] 156 assert(ib[0] == 0); [ 0:15] 157 assert(*ib[1] == 1); [ 0:15] 158 assert(count_equal::count == sb-1); [ 0:15] 159 [ 0:15] 160 Ptr ic[2]; [ 0:15] 161 const unsigned sc = sizeof(ic)/sizeof(ic[0]); [ 0:15] 162 count_equal::count = 0; [ 0:15] 163 r = std::unique(Iter(ic), Iter(ic+sc), count_equal()); [ 0:15] 164 assert(base(r) == ic + 1); [ 0:15] 165 assert(ic[0] == 0); [ 0:15] 166 assert(count_equal::count == sc-1); [ 0:15] 167 [ 0:15] 168 Ptr id[3]; [ 0:15] 169 id[2].reset(&one); [ 0:15] 170 const unsigned sd = sizeof(id)/sizeof(id[0]); [ 0:15] 171 count_equal::count = 0; [ 0:15] 172 r = std::unique(Iter(id), Iter(id+sd), count_equal()); [ 0:15] 173 assert(base(r) == id + 2); [ 0:15] 174 assert(id[0] == 0); [ 0:15] 175 assert(*id[1] == 1); [ 0:15] 176 assert(count_equal::count == sd-1); [ 0:15] 177 [ 0:15] 178 Ptr ie[4]; [ 0:15] 179 ie[2].reset(&one); [ 0:15] 180 const unsigned se = sizeof(ie)/sizeof(ie[0]); [ 0:15] 181 count_equal::count = 0; [ 0:15] 182 r = std::unique(Iter(ie), Iter(ie+se), count_equal()); [ 0:15] 183 assert(base(r) == ie + 3); [ 0:15] 184 assert(ie[0] == 0); [ 0:15] 185 assert(*ie[1] == 1); [ 0:15] 186 assert(ie[2] == 0); [ 0:15] 187 assert(count_equal::count == se-1); [ 0:15] 188 [ 0:15] 189 Ptr ig[4]; [ 0:15] 190 ig[2].reset(&one); [ 0:15] 191 ig[3].reset(&one); [ 0:15] 192 const unsigned sg = sizeof(ig)/sizeof(ig[0]); [ 0:15] 193 count_equal::count = 0; [ 0:15] 194 r = std::unique(Iter(ig), Iter(ig+sg), count_equal()); [ 0:15] 195 assert(base(r) == ig + 2); [ 0:15] 196 assert(ig[0] == 0); [ 0:15] 197 assert(*ig[1] == 1); [ 0:15] 198 assert(count_equal::count == sg-1); [ 0:15] 199 [ 0:15] 200 Ptr ih[3]; [ 0:15] 201 ih[1].reset(&one); [ 0:15] 202 ih[2].reset(&one); [ 0:15] 203 const unsigned sh = sizeof(ih)/sizeof(ih[0]); [ 0:15] 204 count_equal::count = 0; [ 0:15] 205 r = std::unique(Iter(ih), Iter(ih+sh), count_equal()); [ 0:15] 206 assert(base(r) == ih + 2); [ 0:15] 207 assert(ih[0] == 0); [ 0:15] 208 assert(*ih[1] == 1); [ 0:15] 209 assert(count_equal::count == sh-1); [ 0:15] 210 [ 0:15] 211 Ptr ii[7]; [ 0:15] 212 ii[1].reset(&one); [ 0:15] 213 ii[2].reset(&one); [ 0:15] 214 ii[3].reset(&one); [ 0:15] 215 ii[4].reset(&two); [ 0:15] 216 ii[5].reset(&two); [ 0:15] 217 ii[6].reset(&two); [ 0:15] 218 const unsigned si = sizeof(ii)/sizeof(ii[0]); [ 0:15] 219 count_equal::count = 0; [ 0:15] 220 r = std::unique(Iter(ii), Iter(ii+si), count_equal()); [ 0:15] 221 assert(base(r) == ii + 3); [ 0:15] 222 assert(ii[0] == 0); [ 0:15] 223 assert(*ii[1] == 1); [ 0:15] 224 assert(*ii[2] == 2); [ 0:15] 225 assert(count_equal::count == si-1); [ 0:15] 226 } [ 0:15] 227 #endif // TEST_STD_VER >= 11 [ 0:15] 228 [ 0:15] 229 int main(int, char**) [ 0:15] 230 { [ 0:15] 231 test >(); [ 0:15] 232 test >(); [ 0:15] 233 test >(); [ 0:15] 234 test(); [ 0:15] 235 [ 0:15] 236 #if TEST_STD_VER >= 11 [ 0:15] 237 test1 >(); [ 0:15] 238 test1 >(); [ 0:15] 239 test1 >(); [ 0:15] 240 test1(); [ 0:15] 241 #endif [ 0:15] 242 [ 0:15] 243 #if TEST_STD_VER > 17 [ 0:15] 244 static_assert(test_constexpr()); [ 0:15] 245 #endif [ 0:15] 246 [ 0:15] 247 return 0; [ 0:15] 248 } [ 0:15] # no errors were expected but one was found anyway