Kristof Umann | b8ac93c | 2019-09-18 22:24:26 +0000 | [diff] [blame] | 1 | // RUN: %clang_analyze_cc1 -verify %s \ |
| 2 | // RUN: -analyzer-checker=core \ |
| 3 | // RUN: -analyzer-config widen-loops=true \ |
| 4 | // RUN: -analyzer-config track-conditions=false \ |
| 5 | // RUN: -analyzer-max-loop 2 -analyzer-output=text |
| 6 | |
| 7 | namespace pr43102 { |
| 8 | class A { |
| 9 | public: |
| 10 | void m_fn1(); |
| 11 | }; |
| 12 | bool g; |
| 13 | void fn1() { |
| 14 | A a; |
| 15 | A *b = &a; |
| 16 | |
| 17 | for (;;) { // expected-note{{Loop condition is true. Entering loop body}} |
| 18 | // expected-note@-1{{Loop condition is true. Entering loop body}} |
| 19 | // expected-note@-2{{Value assigned to 'b'}} |
| 20 | // no crash during bug report construction |
| 21 | |
| 22 | g = !b; // expected-note{{Assuming 'b' is null}} |
| 23 | b->m_fn1(); // expected-warning{{Called C++ object pointer is null}} |
| 24 | // expected-note@-1{{Called C++ object pointer is null}} |
| 25 | } |
| 26 | } |
| 27 | } // end of namespace pr43102 |