valueFlowRightShift: Do not perform analysis when rhs is negative
This commit is contained in:
parent
1d5e797e6d
commit
dd9a1e890b
|
@ -1156,6 +1156,10 @@ static void valueFlowRightShift(TokenList *tokenList)
|
||||||
if (!tok->astOperand2()->hasKnownValue())
|
if (!tok->astOperand2()->hasKnownValue())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
const MathLib::bigint rhsvalue = tok->astOperand2()->values().front().intvalue;
|
||||||
|
if (rhsvalue < 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (!tok->astOperand1()->valueType() || !tok->astOperand1()->valueType()->isIntegral())
|
if (!tok->astOperand1()->valueType() || !tok->astOperand1()->valueType()->isIntegral())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -1167,7 +1171,7 @@ static void valueFlowRightShift(TokenList *tokenList)
|
||||||
continue;
|
continue;
|
||||||
if (lhsmax < 0)
|
if (lhsmax < 0)
|
||||||
continue;
|
continue;
|
||||||
if ((1 << tok->astOperand2()->values().front().intvalue) <= lhsmax)
|
if ((1 << rhsvalue) <= lhsmax)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ValueFlow::Value val(0);
|
ValueFlow::Value val(0);
|
||||||
|
|
Loading…
Reference in New Issue