[PATCH] D119711: Add asan support for MSVC debug runtimes
Petr Mikhalitsyn via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 15 23:27:57 PST 2022
lo1ol added a comment.
Ok, I get current situation.
Sorry for my late answer. I made some investigation yesterday and compared msvc and clang versions of asan. In my tests msvc version seems more stable.
All my tests is written via catch2 framework (v2.13.8). So, first example is:
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
#include <iostream>
TEST_CASE( "kek" ) {
for (int i=0; i < 10; ++i) {
printf("lol ke\n");
free(malloc(4472));
}
}
If compiles it via msvc version of asan, everything is ok:
# copy MSVC\14.29.30133\lib\x64 to Llvm\x64\lib\clang\12.0.0\lib\windows before
$ clang-cl kek.cpp -I ..\Catch2\single_include /MT -fsanitize=address
$ kek.exe
lol ke
lol ke
lol ke
lol ke
lol ke
lol ke
lol ke
lol ke
lol ke
lol ke
===============================================================================
test cases: 1 | 1 passed
assertions: - none -
But version for clang's toolchain has strange behavior:
# With original content of Llvm\x64\lib\clang\12.0.0\lib\windows
$ clang-cl kek.cpp -I ..\Catch2\single_include /MT -fsanitize=address
$ kek.exe
lol ke
lol ke
lol ke
lol ke
lol ke
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
Nevertheless, I found some bug which presents inside both versions
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
#include <iostream>
#include <future>
TEST_CASE( "kek" ) {
auto result = std::async(std::launch::async, []() {
std::cerr << "kek " << std::endl;
});
result.get();
}
The output is same for both versions:
$ clang-cl kek.cpp -I ..\Catch2\single_include /MT -fsanitize=address
$ kek.exe
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
I don't have a time to discover a root of problem. But msvc's version of asan seems to me more stable and compatible with clang's asan. So, may be there is point to distribute same version of asan for both toolchains.
If you want, I may create an issue for founded bugs.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119711/new/
https://reviews.llvm.org/D119711
More information about the cfe-commits
mailing list