From 208014bae9619152b1733b7a9eb373eabf6b795e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 3 Jan 2021 17:44:46 +0100 Subject: [PATCH] checkIntegerOverflow: Remove bailout for shifts --- lib/checktype.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/checktype.cpp b/lib/checktype.cpp index 30d6acb8c..dade64c55 100644 --- a/lib/checktype.cpp +++ b/lib/checktype.cpp @@ -183,7 +183,7 @@ void CheckType::checkIntegerOverflow() continue; // max value according to platform settings. - const MathLib::bigint maxvalue = (((MathLib::bigint)1) << (bits - 1)) - 1; + const MathLib::bigint maxvalue = (((MathLib::biguint)1) << (bits - 1)) - 1; // is there a overflow result value const ValueFlow::Value *value = tok->getValueGE(maxvalue + 1, mSettings); @@ -193,8 +193,8 @@ void CheckType::checkIntegerOverflow() continue; // For left shift, it's common practice to shift into the sign bit - if (tok->str() == "<<" && value->intvalue > 0 && value->intvalue < (((MathLib::bigint)1) << bits)) - continue; + //if (tok->str() == "<<" && value->intvalue > 0 && value->intvalue < (((MathLib::bigint)1) << bits)) + // continue; integerOverflowError(tok, *value); }