diff options
author | Vitaly Buka <vitalybuka@google.com> | 2019-10-10 23:49:10 +0000 |
---|---|---|
committer | Vitaly Buka <vitalybuka@google.com> | 2019-10-10 23:49:10 +0000 |
commit | d70fe33b97b2d608ffff64b5a45a5db81181cacd (patch) | |
tree | 8cddb2721a7288d1ad428c9982558fb9a8597238 /test/CodeGen | |
parent | e4a195cf1a256ffd6a60e3256e84e551a303c708 (diff) | |
download | clang-d70fe33b97b2d608ffff64b5a45a5db81181cacd.tar.gz |
[tsan,msan] Insert module constructors in a module pass
Summary:
If we insert them from function pass some analysis may be missing or invalid.
Fixes PR42877.
Reviewers: eugenis, leonardchan
Reviewed By: leonardchan
Subscribers: hiraditya, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D68832
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374481 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen')
-rw-r--r-- | test/CodeGen/sanitizer-module-constructor.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/CodeGen/sanitizer-module-constructor.c b/test/CodeGen/sanitizer-module-constructor.c new file mode 100644 index 0000000000..b0fc305369 --- /dev/null +++ b/test/CodeGen/sanitizer-module-constructor.c @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -fsanitize=address -emit-llvm -O3 -fdebug-pass-manager -fexperimental-new-pass-manager -o - %s 2>&1 | FileCheck %s +// RUN: %clang_cc1 -fsanitize=thread -emit-llvm -O3 -fdebug-pass-manager -fexperimental-new-pass-manager -o - %s 2>&1 | FileCheck %s +// RUN: %clang_cc1 -fsanitize=memory -emit-llvm -O3 -fdebug-pass-manager -fexperimental-new-pass-manager -o - %s 2>&1 | FileCheck %s + +// This is regression test for PR42877 + +typedef struct a *b; +struct a { + int c; +}; +int d; +b e; +static void f(b g) { + for (d = g->c;;) + ; +} +void h() { f(e); } + +// CHECK: Running pass: {{.*}}SanitizerPass on {{.*}}sanitizer-module-constructor.c +// CHECK-NOT: Running pass: LoopSimplifyPass on {{.*}}san.module_ctor +// CHECK: Running analysis: DominatorTreeAnalysis on {{.*}}san.module_ctor +// CHECK: Running pass: LoopSimplifyPass on {{.*}}san.module_ctor |