Index: compiler-rt/trunk/test/asan/TestCases/use-after-scope-loop-bug.cc =================================================================== --- compiler-rt/trunk/test/asan/TestCases/use-after-scope-loop-bug.cc +++ compiler-rt/trunk/test/asan/TestCases/use-after-scope-loop-bug.cc @@ -1,8 +1,5 @@ // RUN: %clangxx_asan -O1 -fsanitize-address-use-after-scope %s -o %t && \ // RUN: not %run %t 2>&1 | FileCheck %s -// -// FIXME: @llvm.lifetime.* are not emitted for x. -// XFAIL: * int *p; @@ -13,4 +10,8 @@ p = x + i; } return *p; // BOOM + // CHECK: ERROR: AddressSanitizer: stack-use-after-scope + // CHECK: #0 0x{{.*}} in main {{.*}}use-after-scope-loop-bug.cc:[[@LINE-2]] + // CHECK: Address 0x{{.*}} is located in stack of thread T{{.*}} at offset [[OFFSET:[^ ]+]] in frame + // {{\[}}[[OFFSET]], {{[0-9]+}}) 'x' } Index: compiler-rt/trunk/test/asan/TestCases/use-after-scope-loop-removed.cc =================================================================== --- compiler-rt/trunk/test/asan/TestCases/use-after-scope-loop-removed.cc +++ compiler-rt/trunk/test/asan/TestCases/use-after-scope-loop-removed.cc @@ -1,9 +1,5 @@ // RUN: %clangxx_asan -O1 -fsanitize-address-use-after-scope %s -o %t && \ // RUN: not %run %t 2>&1 | FileCheck %s -// -// FIXME: Compiler removes for-loop but keeps x variable. For unknown reason -// @llvm.lifetime.* are not emitted for x. -// XFAIL: * #include @@ -14,6 +10,9 @@ int x; p = &x; } - return **p; // BOOM + return *p; // BOOM // CHECK: ERROR: AddressSanitizer: stack-use-after-scope + // CHECK: #0 0x{{.*}} in main {{.*}}use-after-scope-loop-removed.cc:[[@LINE-2]] + // CHECK: Address 0x{{.*}} is located in stack of thread T{{.*}} at offset [[OFFSET:[^ ]+]] in frame + // {{\[}}[[OFFSET]], {{[0-9]+}}) 'x' } Index: compiler-rt/trunk/test/asan/TestCases/use-after-scope-temp.cc =================================================================== --- compiler-rt/trunk/test/asan/TestCases/use-after-scope-temp.cc +++ compiler-rt/trunk/test/asan/TestCases/use-after-scope-temp.cc @@ -1,8 +1,6 @@ -// RUN: %clangxx_asan -O1 -fsanitize-address-use-after-scope %s -o %t && \ +// RUN: %clangxx_asan %stdcxx11 -O1 -fsanitize-address-use-after-scope %s -o %t && \ // RUN: not %run %t 2>&1 | FileCheck %s -// -// Lifetime for temporaries is not emitted yet. -// XFAIL: * + struct IntHolder { int val; @@ -15,9 +13,9 @@ } int main(int argc, char *argv[]) { - save({10}); + save({argc}); int x = saved->val; // BOOM -// CHECK: ERROR: AddressSanitizer: stack-use-after-scope -// CHECK: #0 0x{{.*}} in main {{.*}}use-after-scope-temp.cc:[[@LINE-2]] + // CHECK: ERROR: AddressSanitizer: stack-use-after-scope + // CHECK: #0 0x{{.*}} in main {{.*}}use-after-scope-temp.cc:[[@LINE-2]] return x; }