Files
clang-p2996/clang/test/Analysis/uninit-bug-first-iteration-init.c
Aaron Ballman 1ea584377e A significant number of our tests in C accidentally use functions
without prototypes. This patch converts the function signatures to have
a prototype for the situations where the test is not specific to K&R C
declarations. e.g.,

  void func();

becomes

  void func(void);

This is the ninth batch of tests being updated (there are a
significant number of other tests left to be updated).
2022-02-13 08:03:40 -05:00

28 lines
490 B
C

// RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s
// rdar://problem/44978988
// expected-no-diagnostics
int foo(void);
int gTotal;
double bar(int start, int end) {
int i, cnt, processed, size;
double result, inc;
result = 0;
processed = start;
size = gTotal * 2;
cnt = (end - start + 1) * size;
for (i = 0; i < cnt; i += 2) {
if ((i % size) == 0) {
inc = foo();
processed++;
}
result += inc * inc; // no-warning
}
return result;
}