no-outofbounds.c revision 9618b858e2b4f79aa2b8b0291e9c833cee0435f8
1// RUN: %clang_cc1 -analyzer-check-objc-mem -analyze -analyzer-experimental-internal-checks -analyzer-store=basic -verify %s
2// RUN: %clang_cc1 -analyzer-check-objc-mem -analyze -analyzer-experimental-internal-checks -analyzer-store=region -verify %s
3
4//===----------------------------------------------------------------------===//
5// This file tests cases where we should not flag out-of-bounds warnings.
6//===----------------------------------------------------------------------===//
7
8void f() {
9  long x = 0;
10  char *y = (char*) &x;
11  char c = y[0] + y[1] + y[2]; // no-warning
12  short *z = (short*) &x;
13  short s = z[0] + z[1]; // no-warning
14}
15