Skip to content

Commit 208014b

Browse files
committed
checkIntegerOverflow: Remove bailout for shifts
1 parent 23da5c9 commit 208014b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/checktype.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ void CheckType::checkIntegerOverflow()
183183
continue;
184184

185185
// max value according to platform settings.
186-
const MathLib::bigint maxvalue = (((MathLib::bigint)1) << (bits - 1)) - 1;
186+
const MathLib::bigint maxvalue = (((MathLib::biguint)1) << (bits - 1)) - 1;
187187

188188
// is there a overflow result value
189189
const ValueFlow::Value *value = tok->getValueGE(maxvalue + 1, mSettings);
@@ -193,8 +193,8 @@ void CheckType::checkIntegerOverflow()
193193
continue;
194194

195195
// For left shift, it's common practice to shift into the sign bit
196-
if (tok->str() == "<<" && value->intvalue > 0 && value->intvalue < (((MathLib::bigint)1) << bits))
197-
continue;
196+
//if (tok->str() == "<<" && value->intvalue > 0 && value->intvalue < (((MathLib::bigint)1) << bits))
197+
// continue;
198198

199199
integerOverflowError(tok, *value);
200200
}

0 commit comments

Comments
 (0)