clang/test/Analysis/PR35418.cpp
raw| 1 | // RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s |
| 2 | |
| 3 | // expected-no-diagnostics |
| 4 | |
| 5 | void halt() __attribute__((__noreturn__)); |
| 6 | void assert(int b) { |
| 7 | if (!b) |
| 8 | halt(); |
| 9 | } |
| 10 | |
| 11 | void decode(unsigned width) { |
| 12 | assert(width > 0); |
| 13 | |
| 14 | int base; |
| 15 | bool inited = false; |
| 16 | |
| 17 | int i = 0; |
| 18 | |
| 19 | if (i % width == 0) { |
| 20 | base = 512; |
| 21 | inited = true; |
| 22 | } |
| 23 | |
| 24 | base += 1; // no-warning |
| 25 | |
| 26 | if (base >> 10) |
| 27 | assert(false); |
| 28 | } |