]> git.proxmox.com Git - rustc.git/blob - src/compiler-rt/test/asan/TestCases/use-after-scope-loop-bug.cc
New upstream version 1.12.0+dfsg1
[rustc.git] / src / compiler-rt / test / asan / TestCases / use-after-scope-loop-bug.cc
1 // RUN: %clangxx_asan -O1 -fsanitize-address-use-after-scope %s -o %t && \
2 // RUN: not %run %t 2>&1 | FileCheck %s
3 //
4 // FIXME: @llvm.lifetime.* are not emitted for x.
5 // XFAIL: *
6
7 int *p;
8
9 int main() {
10 // Variable goes in and out of scope.
11 for (int i = 0; i < 3; ++i) {
12 int x[3] = {i, i, i};
13 p = x + i;
14 }
15 return *p; // BOOM
16 }