2009-11-08 09:45:36 +08:00
|
|
|
// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify -triple x86_64-apple-darwin9 %s
|
2009-03-24 10:24:46 +08:00
|
|
|
// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify -triple i686-apple-darwin9 %s
|
2009-03-03 08:28:42 +08:00
|
|
|
|
|
|
|
void f1() {
|
|
|
|
int a[10];
|
|
|
|
int *p = a;
|
|
|
|
++p;
|
|
|
|
}
|
2009-03-11 15:43:49 +08:00
|
|
|
|
|
|
|
char* foo();
|
|
|
|
|
|
|
|
void f2() {
|
|
|
|
char *p = foo();
|
|
|
|
++p;
|
|
|
|
}
|
2009-03-11 17:15:38 +08:00
|
|
|
|
2009-03-12 09:55:38 +08:00
|
|
|
// This test case checks if we get the right rvalue type of a TypedViewRegion.
|
|
|
|
// The ElementRegion's type depends on the array region's rvalue type. If it was
|
|
|
|
// a pointer type, we would get a loc::SymbolVal for '*p'.
|
2009-06-05 03:35:30 +08:00
|
|
|
void* memchr();
|
2009-03-11 17:15:38 +08:00
|
|
|
static int
|
|
|
|
domain_port (const char *domain_b, const char *domain_e,
|
|
|
|
const char **domain_e_ptr)
|
|
|
|
{
|
|
|
|
int port = 0;
|
|
|
|
|
|
|
|
const char *p;
|
|
|
|
const char *colon = memchr (domain_b, ':', domain_e - domain_b);
|
|
|
|
|
|
|
|
for (p = colon + 1; p < domain_e ; p++)
|
|
|
|
port = 10 * port + (*p - '0');
|
|
|
|
return port;
|
|
|
|
}
|
2009-11-09 13:34:10 +08:00
|
|
|
|
|
|
|
void f3() {
|
|
|
|
int x, y;
|
|
|
|
int d = &y - &x; // expected-warning{{Subtraction of two pointers that do not point to the same memory chunk may cause incorrect result.}}
|
|
|
|
}
|