Describe the bug
Test results depend on compare-equal elements being treated in a specific way by std::sort (probably they depend on the order of compare-equal elements being preserved, but I haven't verified this)
To Reproduce
Steps to reproduce the behavior:
Use mockturtle master (50ffa108484ba65b44eee4a713832b7ee821d6d8 to be precise)
Apply the following patch
diff --git a/include/mockturtle/utils/tech_library.hpp b/include/mockturtle/utils/tech_library.hpp
index cb3c83e..b40a57e 100644
--- a/include/mockturtle/utils/tech_library.hpp
+++ b/include/mockturtle/utils/tech_library.hpp
@@ -1413,6 +1413,7 @@ private:
}
if ( _ps.np_classification && supergates_neg.size() > 0 )
{
+ std::random_shuffle( supergates_neg.begin(), supergates_neg.end() );
std::sort( supergates_neg.begin(), supergates_neg.end(), [&]( auto const& a, auto const& b ) {
return a.area < b.area;
} );
The details of the failures will vary from run to run.
Environment
This will reproduce in any environment.
Additional context
The random shuffle should be a harmless no-op --- std::sort is allowed to put compare-equal elements in any order, and elements that don't compare equal will be sorted into that order.
Check list
[X] I have tried to run in DEBUG mode and there was no assertion failure (or the reported bug is an assertion failure).
[X] I have made sure that the provided code compiles and the testcase reproduces the error.
Describe the bug Test results depend on compare-equal elements being treated in a specific way by
std::sort
(probably they depend on the order of compare-equal elements being preserved, but I haven't verified this)To Reproduce Steps to reproduce the behavior:
You'll get failures like
The details of the failures will vary from run to run.
Environment This will reproduce in any environment.
Additional context The random shuffle should be a harmless no-op ---
std::sort
is allowed to put compare-equal elements in any order, and elements that don't compare equal will be sorted into that order.Check list