Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions lib/valueflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
if (ret->condition && !settings.severity.isEnabled(Severity::warning))
return nullptr;
}
return ret;
}
Expand Down
7 changes: 7 additions & 0 deletions test/testother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10603,6 +10603,13 @@ class TestOther : public TestFixture {
" return f<-1>(2)\n"
"}\n");
ASSERT_EQUALS("", errout_str());

Settings settings = settingsBuilder(settings0).severity(Severity::portability).build();
check("int f(int k, int& s) {\n" // #7215
" if (k >= -128 && k <= 127)\n"
" s = (k << 8);\n"
"}\n", dinit(CheckOptions, $.settings = &settings));
ASSERT_EQUALS("[test.cpp:2:11] -> [test.cpp:3:16]: (portability) Shifting a negative value is technically undefined behaviour [shiftNegativeLHS]\n", errout_str());
}

void checkNegativeShiftErrorPath() {
Expand Down
Loading