clang/test/Analysis/uninit-bug-first-iteration-init.c
raw| 1 | // RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s |
| 2 | // expected-no-diagnostics |
| 3 | |
| 4 | int foo(void); |
| 5 | |
| 6 | int gTotal; |
| 7 | |
| 8 | double bar(int start, int end) { |
| 9 | int i, cnt, processed, size; |
| 10 | double result, inc; |
| 11 | |
| 12 | result = 0; |
| 13 | processed = start; |
| 14 | size = gTotal * 2; |
| 15 | cnt = (end - start + 1) * size; |
| 16 | |
| 17 | for (i = 0; i < cnt; i += 2) { |
| 18 | if ((i % size) == 0) { |
| 19 | inc = foo(); |
| 20 | processed++; |
| 21 | } |
| 22 | result += inc * inc; // no-warning |
| 23 | } |
| 24 | return result; |
| 25 | } |