Open zhuoqiang opened 2 years ago
I have the same weird problem since last version but I can't simply reproduce the bug.
This happens sometimes when including some files before unit test header (maybe too much files ?).
On my system I have a segfault caused by here (file include/boost/ut.hpp
):
namespace detail {
struct test {
template <class... Ts>
constexpr auto operator=(test_location<void (*)()> _test);
};
}
When I have a look on the parameter attribute _test.test
, it is null (0x0). Also file location is not initialized.
Here is a valgrind output:
==24021== Memcheck, a memory error detector
==24021== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==24021== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==24021== Command: ./build/bin/unit_test
==24021==
==24021== Use of uninitialised value of size 8
==24021== at 0x1953CE: boost::ext::ut::v1_1_8::events::test<void (*)(), boost::ext::ut::v1_1_8::none>::run_impl(void (*)(), boost::ext::ut::v1_1_8::none const&) (ut.hpp:445)
==24021== by 0x1953FE: boost::ext::ut::v1_1_8::events::test<void (*)(), boost::ext::ut::v1_1_8::none>::operator()() (ut.hpp:441)
==24021== by 0x1958D1: auto boost::ext::ut::v1_1_8::runner<boost::ext::ut::v1_1_8::reporter<boost::ext::ut::v1_1_8::printer>, 16>::on<void (*)(), boost::ext::ut::v1_1_8::none>(boost::ext::ut::v1_1_8::events::test<void (*)(), boost::ext::ut::v1_1_8::none>) (ut.hpp:1292)
==24021== by 0x195AE8: decltype(auto) boost::ext::ut::v1_1_8::detail::on<, boost::ext::ut::v1_1_8::events::test<void (*)(), boost::ext::ut::v1_1_8::none> >(boost::ext::ut::v1_1_8::events::test<void (*)(), boost::ext::ut::v1_1_8::none>&&) (ut.hpp:1393)
==24021== by 0x195BB5: auto boost::ext::ut::v1_1_8::detail::test::operator=<>(boost::ext::ut::v1_1_8::detail::test_location<void (*)()>) (ut.hpp:1416)
==24021== ...
==24021==
==24021== Jump to the invalid address stated on the next line
==24021== at 0x0: ???
==24021== by 0x1953FE: boost::ext::ut::v1_1_8::events::test<void (*)(), boost::ext::ut::v1_1_8::none>::operator()() (ut.hpp:441)
==24021== by 0x1958D1: auto boost::ext::ut::v1_1_8::runner<boost::ext::ut::v1_1_8::reporter<boost::ext::ut::v1_1_8::printer>, 16>::on<void (*)(), boost::ext::ut::v1_1_8::none>(boost::ext::ut::v1_1_8::events::test<void (*)(), boost::ext::ut::v1_1_8::none>) (ut.hpp:1292)
==24021== by 0x195AE8: decltype(auto) boost::ext::ut::v1_1_8::detail::on<, boost::ext::ut::v1_1_8::events::test<void (*)(), boost::ext::ut::v1_1_8::none> >(boost::ext::ut::v1_1_8::events::test<void (*)(), boost::ext::ut::v1_1_8::none>&&) (ut.hpp:1393)
==24021== by 0x195BB5: auto boost::ext::ut::v1_1_8::detail::test::operator=<>(boost::ext::ut::v1_1_8::detail::test_location<void (*)()>) (ut.hpp:1416)
==24021== ...
==24021== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==24021==
==24021==
==24021== Process terminating with default action of signal 11 (SIGSEGV)
==24021== Bad permissions for mapped region at address 0x0
==24021== at 0x0: ???
==24021== by 0x1953FE: boost::ext::ut::v1_1_8::events::test<void (*)(), boost::ext::ut::v1_1_8::none>::operator()() (ut.hpp:441)
==24021== by 0x1958D1: auto boost::ext::ut::v1_1_8::runner<boost::ext::ut::v1_1_8::reporter<boost::ext::ut::v1_1_8::printer>, 16>::on<void (*)(), boost::ext::ut::v1_1_8::none>(boost::ext::ut::v1_1_8::events::test<void (*)(), boost::ext::ut::v1_1_8::none>) (ut.hpp:1292)
==24021== by 0x195AE8: decltype(auto) boost::ext::ut::v1_1_8::detail::on<, boost::ext::ut::v1_1_8::events::test<void (*)(), boost::ext::ut::v1_1_8::none> >(boost::ext::ut::v1_1_8::events::test<void (*)(), boost::ext::ut::v1_1_8::none>&&) (ut.hpp:1393)
==24021== by 0x195BB5: auto boost::ext::ut::v1_1_8::detail::test::operator=<>(boost::ext::ut::v1_1_8::detail::test_location<void (*)()>) (ut.hpp:1416)
==24021== ...
==24021==
==24021== HEAP SUMMARY:
==24021== in use at exit: 73,507 bytes in 12 blocks
==24021== total heap usage: 37 allocs, 25 frees, 78,590 bytes allocated
==24021==
==24021== LEAK SUMMARY:
==24021== definitely lost: 0 bytes in 0 blocks
==24021== indirectly lost: 0 bytes in 0 blocks
==24021== possibly lost: 0 bytes in 0 blocks
==24021== still reachable: 73,507 bytes in 12 blocks
==24021== suppressed: 0 bytes in 0 blocks
==24021== Rerun with --leak-check=full to see details of leaked memory
==24021==
==24021== Use --track-origins=yes to see where uninitialised values come from
==24021== For lists of detected and suppressed errors, rerun with: -s
==24021== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
#include <boost/ut.hpp>
as first includeAfter fixing, no valgrind error is detected.
Expected Behavior
exit ok without exception
Actual Behavior
Bus error***Exception
occursSteps to Reproduce the Problem
the following empty test will yield
Bus error***Exception
note that, move
boost/ut.hpp
header to top workaround this issueremoving the empty test case also suppress the issue
Specifications