From 94b13e760c5fa1f0d9f3f285d0d74feca6cd0381 Mon Sep 17 00:00:00 2001 From: firewave Date: Thu, 23 May 2024 15:17:16 +0200 Subject: [PATCH] valueflow.cpp: fixed `-Wmaybe-uninitialized` GCC warning in optimized build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` lib/valueflow.cpp: In function ‘const Token* ValueFlow::solveExprValue(const Token*, const std::function(const Token*)>&, Value&)’: lib/valueflow.cpp:8405:28: warning: ‘intval’ may be used uninitialized [-Wmaybe-uninitialized] 8405 | value.intvalue /= intval; | ~~~~~~~~~~~~~~~^~~~~~~~~ lib/valueflow.cpp:8383:21: note: ‘intval’ was declared here 8383 | MathLib::bigint intval; | ^~~~~~ ``` --- lib/valueflow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 2ebafc8ddaa..67e51684ccc 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -8425,7 +8425,7 @@ const Token* ValueFlow::solveExprValue(const Token* expr, return expr; if (value.isSymbolicValue() && !Token::Match(expr, "+|-")) return expr; - MathLib::bigint intval; + MathLib::bigint intval = 0; const Token* binaryTok = parseBinaryIntOp(expr, eval, intval); const bool rhs = astIsRHS(binaryTok); // If its on the rhs, then -1 multiplication is needed, which is not possible with simple delta analysis used currently for symbolic values