Added option to enable UndefinedBehaviorSanitizer on Clang and GCC.

This commit is contained in:
Lukáš Hejl 2022-01-28 14:51:34 +01:00
parent 46c827c7fc
commit 5f0fea4d58
5 changed files with 70 additions and 0 deletions

23
deps/Boost/Boost.patch vendored Normal file
View file

@ -0,0 +1,23 @@
diff -u ../boost_1_75_0-orig/boost/rational.hpp ./boost/rational.hpp
--- ../boost_1_75_0-orig/boost/rational.hpp 2020-12-03 06:02:19.000000000 +0100
+++ ./boost/rational.hpp 2022-01-27 16:02:27.993848905 +0100
@@ -302,6 +302,9 @@
return *this;
}
template <class T>
+ #if defined(__clang__)
+ __attribute__((no_sanitize("undefined")))
+ #endif
BOOST_CXX14_CONSTEXPR typename boost::enable_if_c<rational_detail::is_compatible_integer<T, IntType>::value, rational&>::type operator*= (const T& i)
{
// Avoid overflow and preserve normalization
@@ -311,6 +314,9 @@
return *this;
}
template <class T>
+ #if defined(__clang__)
+ __attribute__((no_sanitize("undefined")))
+ #endif
BOOST_CXX14_CONSTEXPR typename boost::enable_if_c<rational_detail::is_compatible_integer<T, IntType>::value, rational&>::type operator/= (const T& i)
{
// Avoid repeated construction