diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2016-04-22 00:10:23 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2016-04-22 00:10:23 +0000 |
commit | d2f951ce190c39b711e2563d84b9510b71eecc89 (patch) | |
tree | 3da7cef920eeec953673cb90e37cdee4282374fe /test/asan/TestCases/use-after-scope-temp.cc | |
parent | 33f89a1f101182f2f316a3e142caa93d244b4ee7 (diff) |
Enable stack-use-after-scope tests.
Fix and enable working stack-use-after-scope tests.
Add more failing tests for the feature, for fix later.
PR27453.
Patch by Vitaly Buka.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267084 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/asan/TestCases/use-after-scope-temp.cc')
-rw-r--r-- | test/asan/TestCases/use-after-scope-temp.cc | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/test/asan/TestCases/use-after-scope-temp.cc b/test/asan/TestCases/use-after-scope-temp.cc index f9bd779ac..b238d8547 100644 --- a/test/asan/TestCases/use-after-scope-temp.cc +++ b/test/asan/TestCases/use-after-scope-temp.cc @@ -1,15 +1,10 @@ -// RUN: %clangxx_asan -O0 -fsanitize=use-after-scope %s -o %t && \ -// RUN: %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O1 -mllvm -asan-use-after-scope=1 %s -o %t && \ +// RUN: not %run %t 2>&1 | FileCheck %s // // Lifetime for temporaries is not emitted yet. // XFAIL: * -#include <stdio.h> - struct IntHolder { - explicit IntHolder(int val) : val(val) { - printf("IntHolder: %d\n", val); - } int val; }; @@ -20,10 +15,9 @@ void save(const IntHolder &holder) { } int main(int argc, char *argv[]) { - save(IntHolder(10)); + save({10}); int x = saved->val; // BOOM - // CHECK: ERROR: AddressSanitizer: stack-use-after-scope - // CHECK: #0 0x{{.*}} in main {{.*}}use-after-scope-temp.cc:[[@LINE-2]] - printf("saved value: %d\n", x); - return 0; +// CHECK: ERROR: AddressSanitizer: stack-use-after-scope +// CHECK: #0 0x{{.*}} in main {{.*}}use-after-scope-temp.cc:[[@LINE-2]] + return x; } |