mirror of
https://github.com/boostorg/multiprecision.git
synced 2026-07-21 13:23:49 +00:00
Fix issues with -fsanitize=address [CI SKIP]
This commit is contained in:
@@ -360,6 +360,7 @@ struct gmp_float_imp
|
||||
// happens, account for it here.
|
||||
// example: cout << fixed << setprecision(3) << mpf_float_50("99.9809")
|
||||
digits -= old_e - e;
|
||||
(*free_func_ptr)((void*)ps, std::strlen(ps) + 1);
|
||||
ps = mpf_get_str(0, &e, 10, static_cast<std::size_t>(digits), m_data);
|
||||
--e; // To match with what our formatter expects.
|
||||
}
|
||||
|
||||
@@ -329,6 +329,7 @@ struct mpfr_float_imp<digits10, allocate_dynamic>
|
||||
// change the number of digits to the left of the decimal, if that
|
||||
// happens, account for it here.
|
||||
// example: cout << fixed << setprecision(3) << mpf_float_50("99.9809")
|
||||
mpfr_free_str(ps);
|
||||
digits -= old_e - e;
|
||||
ps = mpfr_get_str(0, &e, 10, static_cast<std::size_t>(digits), m_data, GMP_RNDN);
|
||||
--e; // To match with what our formatter expects.
|
||||
|
||||
@@ -5,9 +5,18 @@
|
||||
|
||||
#include "sf_performance.hpp"
|
||||
|
||||
#ifdef __clang__
|
||||
#if __has_feature(address_sanitizer) || __has_feature(memory_sanitizer)
|
||||
// memory sanitizer is incompatible with this test:
|
||||
# define DISABLE_THIS_TEST
|
||||
#endif
|
||||
#endif
|
||||
|
||||
boost::atomic<unsigned> allocation_count(0);
|
||||
std::map<std::string, std::map<std::string, std::pair<double, unsigned> > > result_table;
|
||||
|
||||
#ifndef DISABLE_THIS_TEST
|
||||
|
||||
void* (*alloc_func_ptr)(size_t);
|
||||
void* (*realloc_func_ptr)(void*, size_t, size_t);
|
||||
void (*free_func_ptr)(void*, size_t);
|
||||
@@ -95,3 +104,7 @@ int main()
|
||||
|
||||
print_quickbook_tables();
|
||||
}
|
||||
|
||||
#else
|
||||
int main() { return 0; }
|
||||
#endif
|
||||
|
||||
@@ -14,6 +14,15 @@
|
||||
#include <boost/multiprecision/cpp_int.hpp>
|
||||
#include "test.hpp"
|
||||
|
||||
#ifdef __clang__
|
||||
#if __has_feature(address_sanitizer) || __has_feature(memory_sanitizer)
|
||||
// memory sanitizer is incompatible with this test:
|
||||
# define DISABLE_THIS_TEST
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_THIS_TEST
|
||||
|
||||
unsigned alloc_count = 0;
|
||||
void* operator new(std::size_t count)
|
||||
{
|
||||
@@ -205,3 +214,7 @@ int main()
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
#else
|
||||
int main(){ return 0; }
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user