[ 0:00] compiling /home/xrockai/src/divine/nightly/test/libcxx/algorithms/clamp.comp.pass.cpp [ 0:00] In file included from /home/xrockai/src/divine/nightly/test/libcxx/algorithms/clamp.comp.pass.cpp:19: [ 0:00] In file included from /dios/libcxx/include/algorithm:639: [ 0:00] In file included from /dios/libcxx/include/initializer_list:46: [ 0:00] In file included from /dios/libcxx/include/cstddef:44: [ 0:00] In file included from /dios/include/stddef.h:10: [ 0:00] In file included from /dios/include/_PDCLIB/int.h:16: [ 0:00] /dios/include/_PDCLIB/cdefs.h:69:10: warning: Unsupported _ _cplusplus (__cplusplus) (too new) (supported: ISO/IEC 14882:1997, ISO/IEC 14882:2011). [ 0:00] #warning Unsupported _ _cplusplus (__cplusplus) (too new) (supported: ISO/IEC 14882:1997, ISO/IEC 14882:2011). [ 0:00] ^ [ 0:00] 1 warning generated. [ 0:01] compiling /dios/lib/config/seqklee.bc [ 0:01] setting up pass: functionmeta, options = [ 0:02] setting up pass: fuse-ctors, options = [ 0:02] KLEE: output directory is "/var/obj/divine-nightly/semidbg/test/__test_work_dir.8/_klee_out" [ 0:05] KLEE: Using Z3 solver backend [ 0:05] WARNING: this target does not support the llvm.stacksave intrinsic. [ 0:05] 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:05] [ 0:05] KLEE: WARNING: undefined reference to function: _Z10klee_abortv [ 0:09] KLEE: WARNING: undefined reference to function: __dios_tainted_init [ 0:09] KLEE: WARNING: undefined reference to function: klee_free [ 0:09] KLEE: WARNING: undefined reference to function: klee_malloc [ 0:09] KLEE: WARNING ONCE: Using zero size array fix for landingpad instruction filter [ 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: 65425 [ 0:10] Stack: [ 0:10] #000065425 in __dios_start (l=2, argc=1, argv=94192627061256, envp=94192627130376) at /dios/libc/sys/start.cpp:87 [ 0:10] #100013420 in _ZN6__dios10sched_nullINS_5ClockINS_10NondetKleeINS_4BaseEEEEEE13run_schedulerINS_7ContextEEEvv () at /dios/sys/sched_null.hpp:163 [ 0:10] #200074005 in klee_boot (argc=2, argv=94192601755008) 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 // [ 0:10] 13 // XFAIL: c++98, c++03, c++11, c++14 [ 0:10] 14 [ 0:10] 15 // template [ 0:10] 16 // const T& [ 0:10] 17 // clamp(const T& v, const T& lo, const T& hi, Compare comp); [ 0:10] 18 [ 0:10] 19 #include [ 0:10] 20 #include [ 0:10] 21 #include [ 0:10] 22 [ 0:10] 23 #include "test_macros.h" [ 0:10] 24 [ 0:10] 25 struct Tag { [ 0:10] 26 Tag() : val(0), tag("Default") {} [ 0:10] 27 Tag(int a, const char *b) : val(a), tag(b) {} [ 0:10] 28 ~Tag() {} [ 0:10] 29 [ 0:10] 30 int val; [ 0:10] 31 const char *tag; [ 0:10] 32 }; [ 0:10] 33 [ 0:10] 34 bool eq(const Tag& rhs, const Tag& lhs) { return rhs.val == lhs.val && rhs.tag == lhs.tag; } [ 0:10] 35 // bool operator==(const Tag& rhs, const Tag& lhs) { return rhs.val == lhs.val; } [ 0:10] 36 bool comp (const Tag& rhs, const Tag& lhs) { return rhs.val < lhs.val; } [ 0:10] 37 [ 0:10] 38 [ 0:10] 39 template [ 0:10] 40 void [ 0:10] 41 test(const T& v, const T& lo, const T& hi, C c, const T& x) [ 0:10] 42 { [ 0:10] 43 assert(&std::clamp(v, lo, hi, c) == &x); [ 0:10] 44 } [ 0:10] 45 [ 0:10] 46 int main(int, char**) [ 0:10] 47 { [ 0:10] 48 { [ 0:10] 49 int x = 0; [ 0:10] 50 int y = 0; [ 0:10] 51 int z = 0; [ 0:10] 52 test(x, y, z, std::greater(), x); [ 0:10] 53 test(y, x, z, std::greater(), y); [ 0:10] 54 } [ 0:10] 55 { [ 0:10] 56 int x = 0; [ 0:10] 57 int y = 1; [ 0:10] 58 int z = -1; [ 0:10] 59 test(x, y, z, std::greater(), x); [ 0:10] 60 test(y, x, z, std::greater(), x); [ 0:10] 61 } [ 0:10] 62 { [ 0:10] 63 int x = 1; [ 0:10] 64 int y = 0; [ 0:10] 65 int z = 0; [ 0:10] 66 test(x, y, z, std::greater(), y); [ 0:10] 67 test(y, x, z, std::greater(), y); [ 0:10] 68 } [ 0:10] 69 [ 0:10] 70 { [ 0:10] 71 // If they're all the same, we should get the value back. [ 0:10] 72 Tag x{0, "Zero-x"}; [ 0:10] 73 Tag y{0, "Zero-y"}; [ 0:10] 74 Tag z{0, "Zero-z"}; [ 0:10] 75 assert(eq(std::clamp(x, y, z, comp), x)); [ 0:10] 76 assert(eq(std::clamp(y, x, z, comp), y)); [ 0:10] 77 } [ 0:10] 78 [ 0:10] 79 { [ 0:10] 80 // If it's the same as the lower bound, we get the value back. [ 0:10] 81 Tag x{0, "Zero-x"}; [ 0:10] 82 Tag y{0, "Zero-y"}; [ 0:10] 83 Tag z{1, "One-z"}; [ 0:10] 84 assert(eq(std::clamp(x, y, z, comp), x)); [ 0:10] 85 assert(eq(std::clamp(y, x, z, comp), y)); [ 0:10] 86 } [ 0:10] 87 [ 0:10] 88 { [ 0:10] 89 // If it's the same as the upper bound, we get the value back. [ 0:10] 90 Tag x{1, "One-x"}; [ 0:10] 91 Tag y{0, "Zero-y"}; [ 0:10] 92 Tag z{1, "One-z"}; [ 0:10] 93 assert(eq(std::clamp(x, y, z, comp), x)); [ 0:10] 94 assert(eq(std::clamp(z, y, x, comp), z)); [ 0:10] 95 } [ 0:10] 96 [ 0:10] 97 { [ 0:10] 98 // If the value is between, we should get the value back [ 0:10] 99 Tag x{1, "One-x"}; [ 0:10] 100 Tag y{0, "Zero-y"}; [ 0:10] 101 Tag z{2, "Two-z"}; [ 0:10] 102 assert(eq(std::clamp(x, y, z, comp), x)); [ 0:10] 103 assert(eq(std::clamp(y, x, z, comp), x)); [ 0:10] 104 } [ 0:10] 105 [ 0:10] 106 { [ 0:10] 107 // If the value is less than the 'lo', we should get the lo back. [ 0:10] 108 Tag x{0, "Zero-x"}; [ 0:10] 109 Tag y{1, "One-y"}; [ 0:10] 110 Tag z{2, "Two-z"}; [ 0:10] 111 assert(eq(std::clamp(x, y, z, comp), y)); [ 0:10] 112 assert(eq(std::clamp(y, x, z, comp), y)); [ 0:10] 113 } [ 0:10] 114 { [ 0:10] 115 // If the value is greater than 'hi', we should get hi back. [ 0:10] 116 Tag x{2, "Two-x"}; [ 0:10] 117 Tag y{0, "Zero-y"}; [ 0:10] 118 Tag z{1, "One-z"}; [ 0:10] 119 assert(eq(std::clamp(x, y, z, comp), z)); [ 0:10] 120 assert(eq(std::clamp(y, z, x, comp), z)); [ 0:10] 121 } [ 0:10] 122 [ 0:10] 123 { [ 0:10] 124 typedef int T; [ 0:10] 125 constexpr T x = 1; [ 0:10] 126 constexpr T y = 0; [ 0:10] 127 constexpr T z = 0; [ 0:10] 128 static_assert(std::clamp(x, y, z, std::greater()) == y, "" ); [ 0:10] 129 static_assert(std::clamp(y, x, z, std::greater()) == y, "" ); [ 0:10] 130 } [ 0:10] 131 [ 0:10] 132 return 0; [ 0:10] 133 } [ 0:10] # no errors were expected but one was found anyway