Ted Kremenek | 033a07e | 2011-08-03 23:14:55 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core %s -analyzer-store=region -verify |
Ted Kremenek | 5c456fe | 2008-10-18 03:28:48 +0000 | [diff] [blame] | 2 | |
| 3 | unsigned foo(); |
| 4 | typedef struct bf { unsigned x:2; } bf; |
| 5 | void bar() { |
| 6 | bf y; |
| 7 | *(unsigned*)&y = foo(); |
| 8 | y.x = 1; |
| 9 | } |
Zhongxing Xu | 5414a5c | 2009-06-21 13:24:24 +0000 | [diff] [blame] | 10 | |
| 11 | struct s { |
| 12 | int n; |
| 13 | }; |
| 14 | |
| 15 | void f() { |
| 16 | struct s a; |
| 17 | int *p = &(a.n) + 1; |
| 18 | } |
Argyrios Kyrtzidis | c2e20d0 | 2011-02-03 22:01:32 +0000 | [diff] [blame] | 19 | |
| 20 | typedef struct { |
| 21 | int x,y; |
| 22 | } Point; |
| 23 | |
| 24 | Point getit(void); |
| 25 | void test() { |
| 26 | Point p; |
| 27 | (void)(p = getit()).x; |
| 28 | } |