[PATCH] D22894: [asan] Enable the rest of use-after-scope tests
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 28 16:11:04 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL277074: [asan] Enable the rest of use-after-scope tests (authored by vitalybuka).
Changed prior to commit:
https://reviews.llvm.org/D22894?vs=65846&id=66050#toc
Repository:
rL LLVM
https://reviews.llvm.org/D22894
Files:
compiler-rt/trunk/test/asan/TestCases/use-after-scope-loop-bug.cc
compiler-rt/trunk/test/asan/TestCases/use-after-scope-loop-removed.cc
compiler-rt/trunk/test/asan/TestCases/use-after-scope-temp.cc
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 <stdlib.h>
@@ -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;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22894.66050.patch
Type: text/x-patch
Size: 2829 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160728/d2b41ee4/attachment.bin>
More information about the llvm-commits
mailing list