aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/region-only-test.c
blob: b1e70a90546db36dd8db99db0b26d465ae40c4fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s

// Region store must be enabled for tests in this file.

// Exercise creating ElementRegion with symbolic super region.
void foo(int* p) {
  int *x;
  int a;
  if (p[0] == 1)
    x = &a;
  if (p[0] == 1)
    (void)*x; // no-warning
}

int a[10];

int *f0() {
  int *p = a+10;
  return p; // expected-warning{{Return of Pointer Value Outside of Expected Range}}
}