forked from OSchip/llvm-project
[asan] Enable the rest of use-after-scope tests
Summary: Test where broken because of missing lifetime markers for temps and because of aggressive optimization which removed markers in some cases. PR27453 Reviewers: eugenis, kcc Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D22894 llvm-svn: 277074
This commit is contained in:
parent
26fb9d268b
commit
49dd9d23cc
|
@ -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 @@ int main() {
|
|||
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'
|
||||
}
|
||||
|
|
|
@ -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 main() {
|
|||
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'
|
||||
}
|
||||
|
|
|
@ -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 @@ void save(const IntHolder &holder) {
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue