[compiler-rt] 8a3d75a - [ASan] Add read to large_func_test.cpp to prevent optimization.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 16 10:00:52 PDT 2022
Author: Florian Hahn
Date: 2022-03-16T17:00:32Z
New Revision: 8a3d75a76036569e011feabc6be36689e434fe66
URL: https://github.com/llvm/llvm-project/commit/8a3d75a76036569e011feabc6be36689e434fe66
DIFF: https://github.com/llvm/llvm-project/commit/8a3d75a76036569e011feabc6be36689e434fe66.diff
LOG: [ASan] Add read to large_func_test.cpp to prevent optimization.
After e5822ded562f, the call to LargeFunction can be optimized out, as x
is never accessed in main. This is causing the test to fail, because the
out-of-bounds access won't be executed.
Adding an extra read and returning the value should prevent the
optimizer from removing the call.
Added:
Modified:
compiler-rt/test/asan/TestCases/large_func_test.cpp
Removed:
################################################################################
diff --git a/compiler-rt/test/asan/TestCases/large_func_test.cpp b/compiler-rt/test/asan/TestCases/large_func_test.cpp
index 6ab76d9606269..563c1458c966e 100644
--- a/compiler-rt/test/asan/TestCases/large_func_test.cpp
+++ b/compiler-rt/test/asan/TestCases/large_func_test.cpp
@@ -54,5 +54,7 @@ int main(int argc, char **argv) {
// CHECK-FreeBSD:{{ #0 0x.* in operator new}}
// CHECK-Darwin: {{ #0 0x.* in .*_Zna}}
// CHECK-NEXT: {{ #1 0x.* in main .*large_func_test.cpp:}}[[@LINE-10]]
+ int y = x[argc];
delete[] x;
+ return y;
}
More information about the llvm-commits
mailing list