@@ -24,11 +24,11 @@ predicate isConstantExpression(Expr e) {
2424
2525bindingset [ right, leftType]
2626pragma [ inline_late]
27- predicate isValidShiftConstantRange ( Expr right , Type leftType ) {
27+ predicate isValidShiftConstantRange ( Expr right , MisraCpp23BuiltInTypes :: NumericType leftType ) {
2828 exists ( int value |
2929 value = right .getValue ( ) .toInt ( ) and
3030 value >= 0 and
31- value < leftType .getSize ( ) * 8
31+ value < leftType .getBuiltInSize ( ) * 8
3232 )
3333}
3434
9999 )
100100 or
101101 // Shift operators - right operand must be unsigned or constant in valid range
102- exists ( BinaryShiftOpOrAssignOp shift , Expr right , Type rightType , Type leftType |
102+ exists (
103+ BinaryShiftOpOrAssignOp shift , Expr right , Type rightType ,
104+ MisraCpp23BuiltInTypes:: NumericType leftType
105+ |
103106 right = shift .getRightOperand ( ) and
104107 x = right and
105108 rightType = right .getExplicitlyConverted ( ) .getType ( ) and
@@ -110,7 +113,7 @@ where
110113 not isValidShiftConstantRange ( right , leftType ) and
111114 message =
112115 "Shift operator '" + shift .getOperator ( ) + "' shifts by " + right .getValue ( ) .toInt ( ) +
113- " which is not within the valid range 0.." + ( ( leftType .getSize ( ) * 8 ) - 1 ) + "."
116+ " which is not within the valid range 0.." + ( ( leftType .getBuiltInSize ( ) * 8 ) - 1 ) + "."
114117 else (
115118 not MisraCpp23BuiltInTypes:: isUnsignedType ( rightType ) and
116119 message =
0 commit comments