From 0901ba9a7e415c2ef156d7022f4c9ca65042b1dc Mon Sep 17 00:00:00 2001 From: Paul Fultz II Date: Sat, 12 Aug 2023 12:58:09 -0500 Subject: [PATCH] Fix 11865: Assert failure in setSymbolic() (#5318) --- lib/valueflow.cpp | 2 ++ test/testvalueflow.cpp | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index b1e7e52a2..85a64f022 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -5448,6 +5448,8 @@ static void valueFlowSymbolicOperators(const SymbolDatabase& symboldatabase, con const Token* arg = tok->next()->astOperand2(); if (!arg) continue; + if (arg->exprId() == 0) + continue; ValueFlow::Value c = inferCondition(">=", arg, 0); if (!c.isKnown()) continue; diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index 8a50059ef..d9faba928 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -7354,6 +7354,11 @@ private: " }\n" "}\n"; valueOfTok(code, "i"); + + code = "void f() {\n" + " if (llabs(0x80000000ffffffffL) == 0x7fffffff00000001L) {}\n" + "}\n"; + valueOfTok(code, "f"); } void valueFlowCrashConstructorInitialization() { // #9577