checkIntegerOverflow: Remove bailout for shifts

This commit is contained in:
Daniel Marjamäki 2021-01-03 17:44:46 +01:00
parent 23da5c9815
commit 208014bae9
1 changed files with 3 additions and 3 deletions

View File

@ -183,7 +183,7 @@ void CheckType::checkIntegerOverflow()
continue; continue;
// max value according to platform settings. // 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 // is there a overflow result value
const ValueFlow::Value *value = tok->getValueGE(maxvalue + 1, mSettings); const ValueFlow::Value *value = tok->getValueGE(maxvalue + 1, mSettings);
@ -193,8 +193,8 @@ void CheckType::checkIntegerOverflow()
continue; continue;
// For left shift, it's common practice to shift into the sign bit // 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)) //if (tok->str() == "<<" && value->intvalue > 0 && value->intvalue < (((MathLib::bigint)1) << bits))
continue; // continue;
integerOverflowError(tok, *value); integerOverflowError(tok, *value);
} }