Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d71a52e

Browse files
committed
Go back to _GLIBCXX_ASSERTIONS; _GLIBCXX_DEBUG causes asan failures
Debug lib mallocs, asan frees. Seems asan can't hijack the debug mallocs, but does hijack the debug fres?
1 parent 670c8cd commit d71a52e

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

test/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,10 @@ if(NOT TEST_INSTALLED_VERSION)
155155
target_compile_options(LoopModels PUBLIC /W4 /WX)
156156
endif()
157157
endif()
158-
target_compile_options(LoopModels PRIVATE -D_GLIBCXX_DEBUG)
159-
target_compile_options(${PROJECT_NAME} PRIVATE -D_GLIBCXX_DEBUG)
158+
# target_compile_options(LoopModels PRIVATE -D_GLIBCXX_DEBUG) target_compile_options(${PROJECT_NAME}
159+
# PRIVATE -D_GLIBCXX_DEBUG)
160+
target_compile_options(LoopModels PRIVATE -D_GLIBCXX_ASSERTIONS)
161+
target_compile_options(${PROJECT_NAME} PRIVATE -D_GLIBCXX_ASSERTIONS)
160162

161163
# ---- code coverage ----
162164

test/TestUtilities.hpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class TestLoopFunction {
3030
llvm::Function *F;
3131
llvm::DataLayout dl;
3232
llvm::TargetTransformInfo TTI;
33-
llvm::Triple targetTripple;
34-
llvm::TargetLibraryInfoImpl TLII;
33+
llvm::Triple targetTripple{};
34+
// llvm::TargetLibraryInfoImpl TLII;
3535
llvm::TargetLibraryInfo TLI;
3636
llvm::AssumptionCache AC;
3737
llvm::ScalarEvolution SE;
@@ -92,8 +92,9 @@ class TestLoopFunction {
9292
llvm::SmallVector<llvm::Type *, 0>(), false)},
9393
F{llvm::Function::Create(
9494
FT, llvm::GlobalValue::LinkageTypes::ExternalLinkage, "foo", mod)},
95-
dl{mod}, TTI{dl}, TLII{targetTripple}, TLI{TLII}, AC{*F, &TTI},
96-
SE{*F, TLI, AC, DT, LI}, BB{llvm::BasicBlock::Create(ctx, "entry", F)},
95+
dl{mod}, TTI{dl}, TLI{llvm::TargetLibraryInfoImpl{targetTripple}, F},
96+
AC{*F, &TTI}, SE{*F, TLI, AC, DT, LI},
97+
BB{llvm::BasicBlock::Create(ctx, "entry", F)},
9798
builder{llvm::IRBuilder(BB)} {
9899

99100
auto fmf{llvm::FastMathFlags()};

test/remarks_test.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ TEST(Remarks, BasicAssertions) {
2121
// "../../test/examples/%s.ll 2>&1 | head -n300 | diff "
2222
// "../../test/examples/%s.txt -",
2323
// testfile, testfile);
24-
sprintf(bufopt.data(),
25-
"opt -mcpu=skylake-avx512 --disable-output "
26-
"-load-pass-plugin=_deps/loopmodels-build/libLoopModels.so "
27-
"-passes=turbo-loop -pass-remarks-analysis=turbo-loop "
28-
"../../test/examples/%s.ll 2>&1 | sdiff -l - "
29-
"../../test/examples/%s.txt",
30-
testfile, testfile);
24+
sprintf(
25+
bufopt.data(),
26+
"LD_PRELOAD=/usr/lib64/libasan.so.8 opt -mcpu=skylake-avx512 "
27+
"--disable-output "
28+
"-load-pass-plugin=_deps/loopmodels-build/libLoopModels.so "
29+
"-passes=turbo-loop -pass-remarks-analysis=turbo-loop "
30+
"../../test/examples/%s.ll 2>&1 | sdiff -l - ../../test/examples/%s.txt",
31+
testfile, testfile);
3132

3233
int rc = system(bufopt.data());
3334
EXPECT_EQ(rc, 0);

0 commit comments

Comments
 (0)