blob: 771323b811143f226bf5b7356694ac19a543d3ab [file] [log] [blame]
Ted Kremenek565e4652010-02-05 02:06:54 +00001// 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
Ted Kremenek2f089912009-07-10 21:48:10 +00003
4//===----------------------------------------------------------------------===//
5// This file tests cases where we should not flag out-of-bounds warnings.
6//===----------------------------------------------------------------------===//
Ted Kremenek0b9ad892009-05-04 14:31:19 +00007
Ted Kremenek20bd7462009-05-04 07:04:36 +00008void f() {
9 long x = 0;
10 char *y = (char*) &x;
11 char c = y[0] + y[1] + y[2]; // no-warning
Zhongxing Xu9618b852010-04-01 08:20:27 +000012 short *z = (short*) &x;
13 short s = z[0] + z[1]; // no-warning
Ted Kremenek20bd7462009-05-04 07:04:36 +000014}