Repository navigation
Conversation
dmcppcheck
left a comment
There was a problem hiding this comment.
AI review
I found no new problems. The PR makes two changes. First, a conditional value now stops at a condition that it cannot decide when the condition reads the tracked expression. Second, a condition is recorded into ProgramMemory only if no operand of the comparison changes, not just the tracked operand. In my own tests the only result that changed was a lost arrayIndexOutOfBoundsCond. It is the same kind of warning that the PR removes on purpose: the warning relies on the unknown loop bound being large enough, so this is the intended trade-off and not a regression. There are no comments on the PR yet.
Testing
- I built
cppcheckandtestrunnerinpr/, andcppcheckinbase/. ./testrunner TestBufferOverrun TestValueFlow TestProgramMemorypassed (313 tests, 0 failures).- The full
./testrunner -qpassed (5428 tests, 0 failures). - I wrote scratch files with variations of the case: a conditional value followed by an undecided condition that reads it (
if (i==5){} if (i<n) a[i],while (i<n), null pointers withp != q, division by a value that may be 0, containersize(), values made conditional by an assignment in anif, and an uninitialized variable). I ran base and PR with--enable=all.- Only one result differed:
Base reports
int a[5]; int f2(int n) { for (int i = 0; i < n; i++) { if (i == 5) {} if (i > n - 3) a[i] = 0; } return 0; }
arrayIndexOutOfBoundsCond(index 6, throughi++). The PR does not. The warning depends on the unknownn, just like the FP that the PR fixes, so I see this as consistent with the intent.
- Only one result differed:
- I ran both versions on
samples/andtest/cfg/*.c*with--enable=warning,style,performance --inconclusive. The output was identical (2485 lines each). - I also started a comparison on
lib/, but it timed out and I did not finish it.
Automated review of 950f5ec by Claude. The pull request was built and tested locally.
|
Test results for commit 950f5ec (tools/test-my-pr.py, main compared to this PR): Test: http://ec2-16-170-140-253.eu-north-1.compute.amazonaws.com/pr-9077/ Posted automatically by the cppcheck PR test runner. +N: warnings only with this PR, -N: warnings only with main. The AI review is written by Claude and can be wrong. |
No description provided.