2008-10-17 13:19:52 +08:00
|
|
|
// RUN: clang -checker-simple -verify %s
|
2008-10-25 22:11:23 +08:00
|
|
|
// RUN: clang -checker-simple -analyzer-store-region -verify %s
|
2008-10-17 13:19:52 +08:00
|
|
|
|
2008-10-24 16:51:58 +08:00
|
|
|
struct s {
|
|
|
|
int data;
|
|
|
|
int data_array[10];
|
|
|
|
};
|
2008-10-17 13:19:52 +08:00
|
|
|
|
2008-10-27 17:19:25 +08:00
|
|
|
typedef struct {
|
|
|
|
int data;
|
|
|
|
} STYPE;
|
|
|
|
|
2008-10-17 13:19:52 +08:00
|
|
|
void f(void) {
|
|
|
|
int a[10];
|
|
|
|
int (*p)[10];
|
|
|
|
p = &a;
|
|
|
|
(*p)[3] = 1;
|
|
|
|
|
|
|
|
struct s d;
|
|
|
|
struct s *q;
|
|
|
|
q = &d;
|
2008-10-24 16:51:58 +08:00
|
|
|
q->data = 3;
|
|
|
|
d.data_array[9] = 17;
|
2008-10-17 13:19:52 +08:00
|
|
|
}
|
2008-10-25 22:11:23 +08:00
|
|
|
|
|
|
|
void f2() {
|
|
|
|
char *p = "/usr/local";
|
|
|
|
char (*q)[4];
|
|
|
|
q = &"abc";
|
|
|
|
}
|
2008-10-27 17:19:25 +08:00
|
|
|
|
|
|
|
void f3() {
|
|
|
|
STYPE s;
|
|
|
|
}
|