summaryrefslogtreecommitdiff
path: root/test/asan/TestCases/use-after-scope.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/asan/TestCases/use-after-scope.cc')
-rw-r--r--test/asan/TestCases/use-after-scope.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/asan/TestCases/use-after-scope.cc b/test/asan/TestCases/use-after-scope.cc
index 1aa6758229dd1..d92dae6572cec 100644
--- a/test/asan/TestCases/use-after-scope.cc
+++ b/test/asan/TestCases/use-after-scope.cc
@@ -1,16 +1,17 @@
// RUN: %clangxx_asan -O1 -fsanitize-address-use-after-scope %s -o %t && \
// RUN: not %run %t 2>&1 | FileCheck %s
-int *p = 0;
+volatile int *p = 0;
int main() {
{
int x = 0;
p = &x;
}
- return *p; // BOOM
+ *p = 5; // BOOM
// CHECK: ERROR: AddressSanitizer: stack-use-after-scope
// CHECK: #0 0x{{.*}} in main {{.*}}use-after-scope.cc:[[@LINE-2]]
// CHECK: Address 0x{{.*}} is located in stack of thread T{{.*}} at offset [[OFFSET:[^ ]+]] in frame
// {{\[}}[[OFFSET]], {{[0-9]+}}) 'x'
+ return 0;
}