From bf0ae6e63ae9d3fe779e5864b32d52514aa2dcf0 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Wed, 16 Aug 2023 11:34:43 +0200 Subject: [PATCH] marked UB-incurring boost::archive::xml_oarchive ctor/dtor as no_sanitize --- test/unordered/serialization_tests.cpp | 30 +++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/test/unordered/serialization_tests.cpp b/test/unordered/serialization_tests.cpp index 82752186..108f5cee 100644 --- a/test/unordered/serialization_tests.cpp +++ b/test/unordered/serialization_tests.cpp @@ -111,11 +111,39 @@ namespace { using test::default_generator; +#if (defined(BOOST_GCC) && BOOST_GCC_VERSION >= 80100) ||\ + (defined(BOOST_CLANG) && BOOST_CLANG_VERSION >= 30700) +#define BOOST_UNORDERED_TEST_NO_SANITIZE_UNDEFINED \ +__attribute__((no_sanitize("undefined"))) +#else +#define BOOST_UNORDERED_TEST_NO_SANITIZE_UNDEFINED +#endif + + template + struct unsanitized_ctor_dtor: Class + { + template + BOOST_UNORDERED_TEST_NO_SANITIZE_UNDEFINED + unsanitized_ctor_dtor(const Arg& x): Class(x) {} + + template + BOOST_UNORDERED_TEST_NO_SANITIZE_UNDEFINED + unsanitized_ctor_dtor(Arg& x): Class(x) {} + + BOOST_UNORDERED_TEST_NO_SANITIZE_UNDEFINED + ~unsanitized_ctor_dtor() + { + } + }; + +#undef BOOST_UNORDERED_TEST_NO_SANITIZE_UNDEFINED + std::pair< boost::archive::text_oarchive, boost::archive::text_iarchive>* text_archive; std::pair< - boost::archive::xml_oarchive, boost::archive::xml_iarchive>* + unsanitized_ctor_dtor, + boost::archive::xml_iarchive>* xml_archive; #ifdef BOOST_UNORDERED_FOA_TESTS