[ 0:00] compiling /home/xrockai/src/divine/nightly/test/libcxx/iterators/ssize.pass.cpp [ 0:00] In file included from /home/xrockai/src/divine/nightly/test/libcxx/iterators/ssize.pass.cpp:19: [ 0:00] In file included from /dios/libcxx/include/iterator:420: [ 0:00] In file included from /dios/libcxx/include/iosfwd:95: [ 0:00] In file included from /dios/libcxx/include/wchar.h:118: [ 0:00] In file included from /dios/include/wchar.h:9: [ 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:03] setting up pass: fuse-ctors, options = [ 0:03] KLEE: output directory is "/var/obj/divine-nightly/semidbg/test/__test_work_dir.3/_klee_out" [ 0:06] KLEE: Using Z3 solver backend [ 0:06] WARNING: this target does not support the llvm.stacksave intrinsic. [ 0:06] 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:06] [ 0:06] KLEE: WARNING: undefined reference to function: _Z10klee_abortv [ 0:10] 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] 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:11] Error: failed external call: __dios_tainted_init [ 0:11] File: /dios/libc/sys/start.cpp [ 0:11] Line: 87 [ 0:11] assembly.ll line: 68714 [ 0:11] Stack: [ 0:11] #000068714 in __dios_start (l=2, argc=1, argv=94034995610632, envp=94034995663368) at /dios/libc/sys/start.cpp:87 [ 0:11] #100016543 in _ZN6__dios10sched_nullINS_5ClockINS_10NondetKleeINS_4BaseEEEEEE13run_schedulerINS_7ContextEEEvv () at /dios/sys/sched_null.hpp:163 [ 0:11] #200077294 in klee_boot (argc=2, argv=94034963656064) at /dios/arch/klee/boot.c:41 [ 0:11] [ 0:11] [ 0:11] 1 /* TAGS: c++ fin */ [ 0:11] 2 /* CC_OPTS: -std=c++2a */ [ 0:11] 3 /* VERIFY_OPTS: -o nofail:malloc */ [ 0:11] 4 //===----------------------------------------------------------------------===// [ 0:11] 5 // [ 0:11] 6 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. [ 0:11] 7 // See https://llvm.org/LICENSE.txt for license information. [ 0:11] 8 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception [ 0:11] 9 // [ 0:11] 10 //===----------------------------------------------------------------------===// [ 0:11] 11 [ 0:11] 12 // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 [ 0:11] 13 [ 0:11] 14 // [ 0:11] 15 // template constexpr auto ssize(const C& c) [ 0:11] 16 // -> common_type_t>; // C++20 [ 0:11] 17 // template constexpr ptrdiff_t ssize(const T (&array)[N]) noexcept; // C++20 [ 0:11] 18 [ 0:11] 19 #include [ 0:11] 20 #include [ 0:11] 21 #include [ 0:11] 22 #include [ 0:11] 23 #include [ 0:11] 24 #include [ 0:11] 25 #include [ 0:11] 26 [ 0:11] 27 #include "test_macros.h" [ 0:11] 28 [ 0:11] 29 [ 0:11] 30 struct short_container { [ 0:11] 31 uint16_t size() const { return 60000; } // not noexcept [ 0:11] 32 }; [ 0:11] 33 [ 0:11] 34 [ 0:11] 35 [ 0:11] 36 template [ 0:11] 37 void test_container(C& c) [ 0:11] 38 { [ 0:11] 39 // Can't say noexcept here because the container might not be [ 0:11] 40 static_assert( std::is_signed_v, ""); [ 0:11] 41 assert ( std::ssize(c) == static_cast(c.size())); [ 0:11] 42 } [ 0:11] 43 [ 0:11] 44 template [ 0:11] 45 void test_const_container(const C& c) [ 0:11] 46 { [ 0:11] 47 // Can't say noexcept here because the container might not be [ 0:11] 48 static_assert( std::is_signed_v, ""); [ 0:11] 49 assert ( std::ssize(c) == static_cast(c.size())); [ 0:11] 50 } [ 0:11] 51 [ 0:11] 52 template [ 0:11] 53 void test_const_container(const std::initializer_list& c) [ 0:11] 54 { [ 0:11] 55 LIBCPP_ASSERT_NOEXCEPT(std::ssize(c)); // our std::ssize is conditionally noexcept [ 0:11] 56 static_assert( std::is_signed_v, ""); [ 0:11] 57 assert ( std::ssize(c) == static_cast(c.size())); [ 0:11] 58 } [ 0:11] 59 [ 0:11] 60 template [ 0:11] 61 void test_container(std::initializer_list& c) [ 0:11] 62 { [ 0:11] 63 LIBCPP_ASSERT_NOEXCEPT(std::ssize(c)); // our std::ssize is conditionally noexcept [ 0:11] 64 static_assert( std::is_signed_v, ""); [ 0:11] 65 assert ( std::ssize(c) == static_cast(c.size())); [ 0:11] 66 } [ 0:11] 67 [ 0:11] 68 template [ 0:11] 69 void test_const_array(const T (&array)[Sz]) [ 0:11] 70 { [ 0:11] 71 ASSERT_NOEXCEPT(std::ssize(array)); [ 0:11] 72 static_assert( std::is_signed_v, ""); [ 0:11] 73 assert ( std::ssize(array) == Sz ); [ 0:11] 74 } [ 0:11] 75 [ 0:11] 76 int main(int, char**) [ 0:11] 77 { [ 0:11] 78 std::vector v; v.push_back(1); [ 0:11] 79 std::list l; l.push_back(2); [ 0:11] 80 std::array a; a[0] = 3; [ 0:11] 81 std::initializer_list il = { 4 }; [ 0:11] 82 test_container ( v ); [ 0:11] 83 ASSERT_SAME_TYPE(ptrdiff_t, decltype(std::ssize(v))); [ 0:11] 84 test_container ( l ); [ 0:11] 85 ASSERT_SAME_TYPE(ptrdiff_t, decltype(std::ssize(l))); [ 0:11] 86 test_container ( a ); [ 0:11] 87 ASSERT_SAME_TYPE(ptrdiff_t, decltype(std::ssize(a))); [ 0:11] 88 test_container ( il ); [ 0:11] 89 ASSERT_SAME_TYPE(ptrdiff_t, decltype(std::ssize(il))); [ 0:11] 90 [ 0:11] 91 test_const_container ( v ); [ 0:11] 92 test_const_container ( l ); [ 0:11] 93 test_const_container ( a ); [ 0:11] 94 test_const_container ( il ); [ 0:11] 95 [ 0:11] 96 std::string_view sv{"ABC"}; [ 0:11] 97 test_container ( sv ); [ 0:11] 98 ASSERT_SAME_TYPE(ptrdiff_t, decltype(std::ssize(sv))); [ 0:11] 99 test_const_container ( sv ); [ 0:11] 100 [ 0:11] 101 static constexpr int arrA [] { 1, 2, 3 }; [ 0:11] 102 ASSERT_SAME_TYPE(ptrdiff_t, decltype(std::ssize(arrA))); [ 0:11] 103 static_assert( std::is_signed_v, ""); [ 0:11] 104 test_const_array ( arrA ); [ 0:11] 105 [ 0:11] 106 // From P1227R2: [ 0:11] 107 // Note that the code does not just return the std::make_signed variant of [ 0:11] 108 // the container's size() method, because it's conceivable that a container [ 0:11] 109 // might choose to represent its size as a uint16_t, supporting up to [ 0:11] 110 // 65,535 elements, and it would be a disaster for std::ssize() to turn a [ 0:11] 111 // size of 60,000 into a size of -5,536. [ 0:11] 112 [ 0:11] 113 short_container sc; [ 0:11] 114 // is the return type signed? Is it big enough to hold 60K? [ 0:11] 115 // is the "signed version" of sc.size() too small? [ 0:11] 116 static_assert( std::is_signed_v< decltype(std::ssize(sc))>, ""); [ 0:11] 117 static_assert( std::numeric_limits< decltype(std::ssize(sc))>::max() > 60000, ""); [ 0:11] 118 static_assert( std::numeric_limits>::max() < 60000, ""); [ 0:11] 119 assert (std::ssize(sc) == 60000); [ 0:11] 120 LIBCPP_ASSERT_NOT_NOEXCEPT(std::ssize(sc)); [ 0:11] 121 [ 0:11] 122 return 0; [ 0:11] 123 } [ 0:11] # no errors were expected but one was found anyway