Fix Coverity warning CID 1405837; negative bit shift

This commit is contained in:
Daniel Marjamäki 2019-09-28 06:31:47 +02:00
parent 6453a85363
commit a3cad7fa51
1 changed files with 3 additions and 0 deletions

View File

@ -1127,6 +1127,9 @@ void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer,
return;
int bits = getIntBitsFromValueType(tok->valueType(), *settings);
if (bits == 0)
return;
if (tok->valueType()->sign == ::ValueType::Sign::SIGNED) {
int128_t v = (int128_t)1 << (bits - 1);
if (minValue.intValue >= -v && maxValue.intValue < v)