73c120a989
Summary: New logic tries to narrow possible result values of the remainder operation based on its operands and their ranges. It also tries to be conservative with negative operands because according to the standard the sign of the result is implementation-defined. rdar://problem/44978988 Differential Revision: https://reviews.llvm.org/D80117
28 lines
486 B
C
28 lines
486 B
C
// RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s
|
|
|
|
// rdar://problem/44978988
|
|
// expected-no-diagnostics
|
|
|
|
int foo();
|
|
|
|
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;
|
|
}
|