Closed jonstewart closed 6 months ago
Did you compile Catch2 library with ASAN (and container overflow? I am not sure if it is compiled in by default, or needs to be turned on explicitly)?
ContainerOverflow check requires cooperation from the container, which in turn means that all TUs touching std::vector
have to have it enabled.
TIL! I'm surprised I haven't run into this in the past — but I'm working on a new system, so some things are different. I did not build Catch2 with asan. There are no other asan issues if I turn this detection off.
Given the intrusive nature of container-overflow, has there been consideration of bringing back header-only usage? Having to rebuild Catch2 with different compiler options to suit the situation seems unsustainable.
Regardless, though, thank you for the quick reply and for Catch2 generally! I wrote my own unit test library because GTest/Boost Test/CppUnit were all terrible, but Catch2 has the right ergonomics and I've been able to abandon my own library.
You can drop the amalgamated .cpp file into your project if you want and it will be compiled as part of your main project build. You can find it in extras/
. However, if you have any C++ dependencies, you have to handle propagating compiler flags to your dependencies either way, as there are various ways to break ABI compatibility between them.
Describe the bug When a source file has been compiled with the AddressSanitizer, it reports a container overflow error during benchmarking, with the callstack inside of
Catch::Benchmark::Benchmark::run
.Expected behavior The benchmark should run without complaint from the AddressSanitizer.
Reproduction steps Steps to reproduce the bug.
Compile and run this code with the AddressSanitizer enabled:
I get this error:
Platform information:
Additional context Add any other context about the problem here.
compilation
I had to compile Catch2 with c++17 support, using
cmake -DCMAKE_CXX_STANDARD=17 -DCMAKE_INSTALL_PREFIX=/Users/me/build ..
as another project I was building made use assertions concerningstring_view
.I will confess that I have not tested the above code in a project on its own yet. I experienced the overflow in a different test, wrote the above as a simpler example, used the filter feature to run only the new test case, and got it to repro as well. I'll try to isolate more, but the executable isn't doing anything other than a small number of test cases, with nothing complicated (if at all?) happening at static time.