Anna Zaks | 4e9179a | 2013-05-28 17:31:43 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -verify %s |
2 | // expected-no-diagnostics | ||||
3 | struct X { | ||||
4 | int *p; | ||||
5 | int zero; | ||||
6 | void foo () { | ||||
7 | reset(p - 1); | ||||
8 | } | ||||
9 | void reset(int *in) { | ||||
10 | while (in != p) // Loop must be entered. | ||||
11 | zero = 1; | ||||
12 | } | ||||
13 | }; | ||||
14 | |||||
15 | int test (int *in) { | ||||
16 | X littleX; | ||||
17 | littleX.zero = 0; | ||||
18 | littleX.p = in; | ||||
19 | littleX.foo(); | ||||
20 | return 5/littleX.zero; // no-warning | ||||
21 | } | ||||
22 |