Repository navigation
Fix #7215 shiftNegativeLHS msg only printed with --enable=all #9040
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7612,8 +7612,6 @@ const ValueFlow::Value* ValueFlow::findValue(const std::list<ValueFlow::Value>& | |
| if (ret) { | ||
| if (ret->isInconclusive() && !settings.certainty.isEnabled(Certainty::inconclusive)) | ||
| return nullptr; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AI review Removing the int f6(int k) {
if (k < 0) {}
return 2 >> k;
}
The RHS path needs the same |
||
| if (ret->condition && !settings.severity.isEnabled(Severity::warning)) | ||
| return nullptr; | ||
| } | ||
| return ret; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AI review
The
ret->condition && !warningcheck removed here was the only severity gate for several callers ofgetValueLE/getValueGE/findValue. These includeCheckBufferOverrun::negativeArraySize,negativeMemoryAllocationSizeandCheckStl::negativeIndex(negativeContainerIndex). Without it, default settings now produce new output:cppcheck t1.cpp(no --enable) now reportswarning:negativeMemoryAllocationSize,warning:negativeContainerIndexanderror:negativeArraySize(an error that rests only on a condition value). Base reports none of them. Either keep the filter and letcheckNegativeBitwiseShiftrequest conditional values explicitly, or add a!value->condition || isEnabled(warning)check to each of these callers, asCheckBufferOverrun::negativeIndexErrordoes.