summaryrefslogtreecommitdiff
path: root/test/asan/TestCases/use-after-scope-nobug.cc
blob: c23acf76eaeefd9aa2adb00ce2a6f37ea1ec99f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// RUN: %clangxx_asan -O0 -fsanitize=use-after-scope %s -o %t && %t

#include <stdio.h>

int main() {
  int *p = 0;
  // Variable goes in and out of scope.
  for (int i = 0; i < 3; i++) {
    int x = 0;
    p = &x;
  }
  printf("PASSED\n");
  return 0;
}