array-struct.c revision 7b2d21e3710781fa223d8200b59c841771ff73d3
1// RUN: clang -checker-simple -verify %s && 2// RUN: clang -checker-simple -analyzer-store-region -verify %s 3 4struct s { 5 int data; 6 int data_array[10]; 7}; 8 9typedef struct { 10 int data; 11} STYPE; 12 13void g1(struct s* p); 14 15void f(void) { 16 int a[10]; 17 int (*p)[10]; 18 p = &a; 19 (*p)[3] = 1; 20 21 struct s d; 22 struct s *q; 23 q = &d; 24 q->data = 3; 25 d.data_array[9] = 17; 26} 27 28void f2() { 29 char *p = "/usr/local"; 30 char (*q)[4]; 31 q = &"abc"; 32} 33 34void f3() { 35 STYPE s; 36} 37 38void f4() { 39 int a[] = { 1, 2, 3}; 40 int b[3] = { 1, 2 }; 41} 42 43void f5() { 44 struct s data; 45 g1(&data); 46} 47