mirror of
https://github.com/boostorg/utility.git
synced 2025-07-31 13:27:34 +02:00
Disabled random operators tests under UBSAN.
The tests use random input to various arithmetic and bitwise operators, which cause undefined behavior, such as shifting by more than the left operand capacity or signed integer overflows.
This commit is contained in:
@@ -28,7 +28,6 @@
|
|||||||
|
|
||||||
#include <iostream> // for std::cout (std::endl indirectly)
|
#include <iostream> // for std::cout (std::endl indirectly)
|
||||||
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
// avoiding a template version of true_value so as to not confuse VC++
|
// avoiding a template version of true_value so as to not confuse VC++
|
||||||
@@ -615,6 +614,8 @@ main()
|
|||||||
|
|
||||||
cout << "Created point, and operated on it." << endl;
|
cout << "Created point, and operated on it." << endl;
|
||||||
|
|
||||||
|
#if !defined(UBSAN)
|
||||||
|
// Using random values produce UB in various tests, such as shifting by more than the left operand capacity or signed integer overflows
|
||||||
for (int n = 0; n < 1000; ++n) // was 10,000 but took too long (Beman)
|
for (int n = 0; n < 1000; ++n) // was 10,000 but took too long (Beman)
|
||||||
{
|
{
|
||||||
boost::detail::minstd_rand r;
|
boost::detail::minstd_rand r;
|
||||||
@@ -640,6 +641,7 @@ main()
|
|||||||
}
|
}
|
||||||
|
|
||||||
cout << "Did random tester loop." << endl;
|
cout << "Did random tester loop." << endl;
|
||||||
|
#endif // !defined(UBSAN)
|
||||||
|
|
||||||
MyInt i1(1);
|
MyInt i1(1);
|
||||||
MyInt i2(2);
|
MyInt i2(2);
|
||||||
|
Reference in New Issue
Block a user