Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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: 2 additions & 0 deletions lib/valueflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3606,6 +3606,8 @@
continue;
if (tok->astOperand2()->exprId() == 0)
continue;
if (tok->astOperand2()->variable() && tok->astOperand2()->variable()->isArray() && tok->astOperand2()->variable()->getTypeName() != "std::array) // array to pointer decay

Check failure

Code scanning / Cppcheck Premium

No pair for character ("). Can't process file. File is either invalid or unicode, which is currently not supported. Error

No pair for character ("). Can't process file. File is either invalid or unicode, which is currently not supported.
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
continue;
if (!isConstExpression(tok->astOperand2(), settings.library))
continue;
if (tok->astOperand1()->valueType() && tok->astOperand2()->valueType()) {
Expand Down
9 changes: 9 additions & 0 deletions test/testvalueflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9092,6 +9092,15 @@ class TestValueFlow : public TestFixture {
" return x;\n"
"}\n";
ASSERT_EQUALS(false, testValueOfX(code, 3U, "malloc(10)", 0));

code = "struct S {\n" // #14891
" void f() const {\n"
" const int* p = a;\n"
" if (*p) {}\n"
" }\n"
" int a[3];\n"
"};\n";
ASSERT(tokenValues(code, "* p )").empty());
}

void valueFlowSymbolicIdentity()
Expand Down
Loading