From 2dc3ba324573fe76209707176e5fe9fec9aaa968 Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Fri, 24 Feb 2023 15:44:02 -0800 Subject: [PATCH 01/53] Initialize Types package --- .../INT34-C/DoNotShiftAnExpressionByANegat.md | 16 + .../INT34-C/DoNotShiftAnExpressionByANegat.ql | 19 + ...ftedbyNegativeOrGreaterPrecisionOperand.md | 16 + ...ftedbyNegativeOrGreaterPrecisionOperand.ql | 19 + ...tingAPointerToIntegerOrIntegerToPointer.md | 18 + ...tingAPointerToIntegerOrIntegerToPointer.ql | 19 + .../DoNotShiftAnExpressionByANegat.expected | 1 + .../DoNotShiftAnExpressionByANegat.qlref | 1 + ...NegativeOrGreaterPrecisionOperand.expected | 1 + ...dbyNegativeOrGreaterPrecisionOperand.qlref | 1 + ...ointerToIntegerOrIntegerToPointer.expected | 1 + ...gAPointerToIntegerOrIntegerToPointer.qlref | 1 + ...ainNumericalTypeUsedOverExplicitTypedef.ql | 19 + .../DIR-4-6/TypedefsThatIndicateSizeAndSig.ql | 18 + .../RULE-12-5/SizeofOperatorHaveAnOperan.ql | 19 + .../SizeofOperatorUsedOnArrayTypeParam.ql | 19 + .../StringLiteralAssignedToAnObject.ql | 19 + .../StringLiteralAssignedToNonConstChar.ql | 19 + ...ericalTypeUsedOverExplicitTypedef.expected | 1 + ...NumericalTypeUsedOverExplicitTypedef.qlref | 1 + .../TypedefsThatIndicateSizeAndSig.expected | 1 + .../TypedefsThatIndicateSizeAndSig.qlref | 1 + .../SizeofOperatorHaveAnOperan.expected | 1 + .../SizeofOperatorHaveAnOperan.qlref | 1 + ...izeofOperatorUsedOnArrayTypeParam.expected | 1 + .../SizeofOperatorUsedOnArrayTypeParam.qlref | 1 + .../StringLiteralAssignedToAnObject.expected | 1 + .../StringLiteralAssignedToAnObject.qlref | 1 + ...ringLiteralAssignedToNonConstChar.expected | 1 + .../StringLiteralAssignedToNonConstChar.qlref | 1 + .../cpp/exclusions/c/RuleMetadata.qll | 7 +- .../cpp/exclusions/c/Types.qll | 519 ++---------------- rule_packages/c/Types.json | 482 ++++++++++++++++ 33 files changed, 772 insertions(+), 474 deletions(-) create mode 100644 c/cert/src/rules/INT34-C/DoNotShiftAnExpressionByANegat.md create mode 100644 c/cert/src/rules/INT34-C/DoNotShiftAnExpressionByANegat.ql create mode 100644 c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.md create mode 100644 c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql create mode 100644 c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.md create mode 100644 c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql create mode 100644 c/cert/test/rules/INT34-C/DoNotShiftAnExpressionByANegat.expected create mode 100644 c/cert/test/rules/INT34-C/DoNotShiftAnExpressionByANegat.qlref create mode 100644 c/cert/test/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.expected create mode 100644 c/cert/test/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.qlref create mode 100644 c/cert/test/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.expected create mode 100644 c/cert/test/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.qlref create mode 100644 c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql create mode 100644 c/misra/src/rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.ql create mode 100644 c/misra/src/rules/RULE-12-5/SizeofOperatorHaveAnOperan.ql create mode 100644 c/misra/src/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.ql create mode 100644 c/misra/src/rules/RULE-7-4/StringLiteralAssignedToAnObject.ql create mode 100644 c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql create mode 100644 c/misra/test/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.expected create mode 100644 c/misra/test/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.qlref create mode 100644 c/misra/test/rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.expected create mode 100644 c/misra/test/rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.qlref create mode 100644 c/misra/test/rules/RULE-12-5/SizeofOperatorHaveAnOperan.expected create mode 100644 c/misra/test/rules/RULE-12-5/SizeofOperatorHaveAnOperan.qlref create mode 100644 c/misra/test/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.expected create mode 100644 c/misra/test/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.qlref create mode 100644 c/misra/test/rules/RULE-7-4/StringLiteralAssignedToAnObject.expected create mode 100644 c/misra/test/rules/RULE-7-4/StringLiteralAssignedToAnObject.qlref create mode 100644 c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.expected create mode 100644 c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.qlref create mode 100644 rule_packages/c/Types.json diff --git a/c/cert/src/rules/INT34-C/DoNotShiftAnExpressionByANegat.md b/c/cert/src/rules/INT34-C/DoNotShiftAnExpressionByANegat.md new file mode 100644 index 0000000000..66c3d5a7a0 --- /dev/null +++ b/c/cert/src/rules/INT34-C/DoNotShiftAnExpressionByANegat.md @@ -0,0 +1,16 @@ +# INT34-C: Do not shift an expression by a negative number of bits or by greater than or equal to the number of + +This query implements the CERT-C rule INT34-C: + +> Do not shift an expression by a negative number of bits or by greater than or equal to the number of bits that exist in the operand +## CERT + +** REPLACE THIS BY RUNNING THE SCRIPT `scripts/help/cert-help-extraction.py` ** + +## Implementation notes + +None + +## References + +* CERT-C: [INT34-C: Do not shift an expression by a negative number of bits or by greater than or equal to the number of bits that exist in the operand](https://wiki.sei.cmu.edu/confluence/display/c) diff --git a/c/cert/src/rules/INT34-C/DoNotShiftAnExpressionByANegat.ql b/c/cert/src/rules/INT34-C/DoNotShiftAnExpressionByANegat.ql new file mode 100644 index 0000000000..ac5def1e01 --- /dev/null +++ b/c/cert/src/rules/INT34-C/DoNotShiftAnExpressionByANegat.ql @@ -0,0 +1,19 @@ +/** + * @id c/cert/do-not-shift-an-expression-by-a-negat + * @name INT34-C: Do not shift an expression by a negative number of bits or by greater than or equal to the number of + * @description Do not shift an expression by a negative number of bits or by greater than or equal + * to the number of bits that exist in the operand.. + * @kind problem + * @precision very-high + * @problem.severity error + * @tags external/cert/id/int34-c + * external/cert/obligation/rule + */ + +import cpp +import codingstandards.c.cert + +from +where + not isExcluded(x, TypesPackage::doNotShiftAnExpressionByANegatQuery()) and +select diff --git a/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.md b/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.md new file mode 100644 index 0000000000..601dea39c0 --- /dev/null +++ b/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.md @@ -0,0 +1,16 @@ +# INT34-C: Bit shift should not be done by a negative operand or an operand of greater-or-equal precision than that of another + +This query implements the CERT-C rule INT34-C: + +> Do not shift an expression by a negative number of bits or by greater than or equal to the number of bits that exist in the operand +## CERT + +** REPLACE THIS BY RUNNING THE SCRIPT `scripts/help/cert-help-extraction.py` ** + +## Implementation notes + +None + +## References + +* CERT-C: [INT34-C: Do not shift an expression by a negative number of bits or by greater than or equal to the number of bits that exist in the operand](https://wiki.sei.cmu.edu/confluence/display/c) diff --git a/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql b/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql new file mode 100644 index 0000000000..63de22a8cb --- /dev/null +++ b/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql @@ -0,0 +1,19 @@ +/** + * @id c/cert/expr-shiftedby-negative-or-greater-precision-operand + * @name INT34-C: Bit shift should not be done by a negative operand or an operand of greater-or-equal precision than that of another + * @description Shifting an expression by an operand that is negative or of precision greater or + * equal to that or the another causes representational error. + * @kind problem + * @precision very-high + * @problem.severity error + * @tags external/cert/id/int34-c + * external/cert/obligation/rule + */ + +import cpp +import codingstandards.c.cert + +from +where + not isExcluded(x, TypesPackage::exprShiftedbyNegativeOrGreaterPrecisionOperandQuery()) and +select diff --git a/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.md b/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.md new file mode 100644 index 0000000000..f2fd9caa6e --- /dev/null +++ b/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.md @@ -0,0 +1,18 @@ +# INT36-C: Do not convert pointers to integers and back + +This query implements the CERT-C rule INT36-C: + +> Converting a pointer to integer or integer to pointer + + +## CERT + +** REPLACE THIS BY RUNNING THE SCRIPT `scripts/help/cert-help-extraction.py` ** + +## Implementation notes + +None + +## References + +* CERT-C: [INT36-C: Converting a pointer to integer or integer to pointer](https://wiki.sei.cmu.edu/confluence/display/c) diff --git a/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql b/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql new file mode 100644 index 0000000000..f63fa16f68 --- /dev/null +++ b/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql @@ -0,0 +1,19 @@ +/** + * @id c/cert/converting-a-pointer-to-integer-or-integer-to-pointer + * @name INT36-C: Do not convert pointers to integers and back + * @description Converting between pointers and integers is not portable and might cause invalid + * memory access. + * @kind problem + * @precision very-high + * @problem.severity error + * @tags external/cert/id/int36-c + * external/cert/obligation/rule + */ + +import cpp +import codingstandards.c.cert + +from +where + not isExcluded(x, TypesPackage::convertingAPointerToIntegerOrIntegerToPointerQuery()) and +select diff --git a/c/cert/test/rules/INT34-C/DoNotShiftAnExpressionByANegat.expected b/c/cert/test/rules/INT34-C/DoNotShiftAnExpressionByANegat.expected new file mode 100644 index 0000000000..2ec1a0ac6c --- /dev/null +++ b/c/cert/test/rules/INT34-C/DoNotShiftAnExpressionByANegat.expected @@ -0,0 +1 @@ +No expected results have yet been specified \ No newline at end of file diff --git a/c/cert/test/rules/INT34-C/DoNotShiftAnExpressionByANegat.qlref b/c/cert/test/rules/INT34-C/DoNotShiftAnExpressionByANegat.qlref new file mode 100644 index 0000000000..2c0ac34aa2 --- /dev/null +++ b/c/cert/test/rules/INT34-C/DoNotShiftAnExpressionByANegat.qlref @@ -0,0 +1 @@ +rules/INT34-C/DoNotShiftAnExpressionByANegat.ql \ No newline at end of file diff --git a/c/cert/test/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.expected b/c/cert/test/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.expected new file mode 100644 index 0000000000..2ec1a0ac6c --- /dev/null +++ b/c/cert/test/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.expected @@ -0,0 +1 @@ +No expected results have yet been specified \ No newline at end of file diff --git a/c/cert/test/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.qlref b/c/cert/test/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.qlref new file mode 100644 index 0000000000..9ed91335c9 --- /dev/null +++ b/c/cert/test/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.qlref @@ -0,0 +1 @@ +rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql \ No newline at end of file diff --git a/c/cert/test/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.expected b/c/cert/test/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.expected new file mode 100644 index 0000000000..2ec1a0ac6c --- /dev/null +++ b/c/cert/test/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.expected @@ -0,0 +1 @@ +No expected results have yet been specified \ No newline at end of file diff --git a/c/cert/test/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.qlref b/c/cert/test/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.qlref new file mode 100644 index 0000000000..70ae157f74 --- /dev/null +++ b/c/cert/test/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.qlref @@ -0,0 +1 @@ +rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql \ No newline at end of file diff --git a/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql b/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql new file mode 100644 index 0000000000..7e420aa1a3 --- /dev/null +++ b/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql @@ -0,0 +1,19 @@ +/** + * @id c/misra/plain-numerical-type-used-over-explicit-typedef + * @name DIR-4-6: Do not use plain numerical types over typedefs named after their explicit bit layout + * @description Using plain numerical types over typedefs with explicit sign and bit counts may lead + * to confusion on how much bits are allocated for a value. + * @kind problem + * @precision high + * @problem.severity error + * @tags external/misra/id/dir-4-6 + * external/misra/obligation/advisory + */ + +import cpp +import codingstandards.c.misra + +from +where + not isExcluded(x, TypesPackage::plainNumericalTypeUsedOverExplicitTypedefQuery()) and +select diff --git a/c/misra/src/rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.ql b/c/misra/src/rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.ql new file mode 100644 index 0000000000..32f6f10a9a --- /dev/null +++ b/c/misra/src/rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.ql @@ -0,0 +1,18 @@ +/** + * @id c/misra/typedefs-that-indicate-size-and-sig + * @name DIR-4-6: typedefs that indicate size and signedness should be used in place of the basic numerical types + * @description TODO. + * @kind problem + * @precision high + * @problem.severity error + * @tags external/misra/id/dir-4-6 + * external/misra/obligation/advisory + */ + +import cpp +import codingstandards.c.misra + +from +where + not isExcluded(x, TypesPackage::typedefsThatIndicateSizeAndSigQuery()) and +select diff --git a/c/misra/src/rules/RULE-12-5/SizeofOperatorHaveAnOperan.ql b/c/misra/src/rules/RULE-12-5/SizeofOperatorHaveAnOperan.ql new file mode 100644 index 0000000000..46b1ffc740 --- /dev/null +++ b/c/misra/src/rules/RULE-12-5/SizeofOperatorHaveAnOperan.ql @@ -0,0 +1,19 @@ +/** + * @id c/misra/sizeof-operator-have-an-operan + * @name RULE-12-5: The sizeof operator shall not have an operand which is a function parameter declared as 'array of + * @description The sizeof operator shall not have an operand which is a function parameter declared + * as 'array of type'. + * @kind problem + * @precision very-high + * @problem.severity error + * @tags external/misra/id/rule-12-5 + * external/misra/obligation/mandatory + */ + +import cpp +import codingstandards.c.misra + +from +where + not isExcluded(x, TypesPackage::sizeofOperatorHaveAnOperanQuery()) and +select diff --git a/c/misra/src/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.ql b/c/misra/src/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.ql new file mode 100644 index 0000000000..e5a212b033 --- /dev/null +++ b/c/misra/src/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.ql @@ -0,0 +1,19 @@ +/** + * @id c/misra/sizeof-operator-used-on-array-type-param + * @name RULE-12-5: The sizeof operator should not be used on an array type function parameter. + * @description Using sizeof operator on an array type function parameter leads to unintended + * results. + * @kind problem + * @precision very-high + * @problem.severity error + * @tags external/misra/id/rule-12-5 + * external/misra/obligation/mandatory + */ + +import cpp +import codingstandards.c.misra + +from +where + not isExcluded(x, TypesPackage::sizeofOperatorUsedOnArrayTypeParamQuery()) and +select diff --git a/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToAnObject.ql b/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToAnObject.ql new file mode 100644 index 0000000000..5842903f79 --- /dev/null +++ b/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToAnObject.ql @@ -0,0 +1,19 @@ +/** + * @id c/misra/string-literal-assigned-to-an-object + * @name RULE-7-4: A string literal shall not be assigned to an object unless the object's type is 'pointer to + * @description A string literal shall not be assigned to an object unless the object's type is + * 'pointer to const-qualified char'. + * @kind problem + * @precision very-high + * @problem.severity error + * @tags external/misra/id/rule-7-4 + * external/misra/obligation/required + */ + +import cpp +import codingstandards.c.misra + +from +where + not isExcluded(x, TypesPackage::stringLiteralAssignedToAnObjectQuery()) and +select diff --git a/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql b/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql new file mode 100644 index 0000000000..cf92446bca --- /dev/null +++ b/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql @@ -0,0 +1,19 @@ +/** + * @id c/misra/string-literal-assigned-to-non-const-char + * @name RULE-7-4: A string literal shall only be assigned to a pointer to const char. + * @description Assigning string literal to a variable with type other than a pointer to const char + * and modifying it causes undefined behavior . + * @kind problem + * @precision very-high + * @problem.severity error + * @tags external/misra/id/rule-7-4 + * external/misra/obligation/required + */ + +import cpp +import codingstandards.c.misra + +from +where + not isExcluded(x, TypesPackage::stringLiteralAssignedToNonConstCharQuery()) and +select diff --git a/c/misra/test/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.expected b/c/misra/test/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.expected new file mode 100644 index 0000000000..2ec1a0ac6c --- /dev/null +++ b/c/misra/test/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.expected @@ -0,0 +1 @@ +No expected results have yet been specified \ No newline at end of file diff --git a/c/misra/test/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.qlref b/c/misra/test/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.qlref new file mode 100644 index 0000000000..283e88209c --- /dev/null +++ b/c/misra/test/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.qlref @@ -0,0 +1 @@ +rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql \ No newline at end of file diff --git a/c/misra/test/rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.expected b/c/misra/test/rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.expected new file mode 100644 index 0000000000..2ec1a0ac6c --- /dev/null +++ b/c/misra/test/rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.expected @@ -0,0 +1 @@ +No expected results have yet been specified \ No newline at end of file diff --git a/c/misra/test/rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.qlref b/c/misra/test/rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.qlref new file mode 100644 index 0000000000..9a6e2990cd --- /dev/null +++ b/c/misra/test/rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.qlref @@ -0,0 +1 @@ +rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.ql \ No newline at end of file diff --git a/c/misra/test/rules/RULE-12-5/SizeofOperatorHaveAnOperan.expected b/c/misra/test/rules/RULE-12-5/SizeofOperatorHaveAnOperan.expected new file mode 100644 index 0000000000..2ec1a0ac6c --- /dev/null +++ b/c/misra/test/rules/RULE-12-5/SizeofOperatorHaveAnOperan.expected @@ -0,0 +1 @@ +No expected results have yet been specified \ No newline at end of file diff --git a/c/misra/test/rules/RULE-12-5/SizeofOperatorHaveAnOperan.qlref b/c/misra/test/rules/RULE-12-5/SizeofOperatorHaveAnOperan.qlref new file mode 100644 index 0000000000..2986a9fda3 --- /dev/null +++ b/c/misra/test/rules/RULE-12-5/SizeofOperatorHaveAnOperan.qlref @@ -0,0 +1 @@ +rules/RULE-12-5/SizeofOperatorHaveAnOperan.ql \ No newline at end of file diff --git a/c/misra/test/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.expected b/c/misra/test/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.expected new file mode 100644 index 0000000000..2ec1a0ac6c --- /dev/null +++ b/c/misra/test/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.expected @@ -0,0 +1 @@ +No expected results have yet been specified \ No newline at end of file diff --git a/c/misra/test/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.qlref b/c/misra/test/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.qlref new file mode 100644 index 0000000000..6b6424aad4 --- /dev/null +++ b/c/misra/test/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.qlref @@ -0,0 +1 @@ +rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.ql \ No newline at end of file diff --git a/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToAnObject.expected b/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToAnObject.expected new file mode 100644 index 0000000000..2ec1a0ac6c --- /dev/null +++ b/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToAnObject.expected @@ -0,0 +1 @@ +No expected results have yet been specified \ No newline at end of file diff --git a/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToAnObject.qlref b/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToAnObject.qlref new file mode 100644 index 0000000000..b48e298e04 --- /dev/null +++ b/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToAnObject.qlref @@ -0,0 +1 @@ +rules/RULE-7-4/StringLiteralAssignedToAnObject.ql \ No newline at end of file diff --git a/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.expected b/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.expected new file mode 100644 index 0000000000..2ec1a0ac6c --- /dev/null +++ b/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.expected @@ -0,0 +1 @@ +No expected results have yet been specified \ No newline at end of file diff --git a/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.qlref b/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.qlref new file mode 100644 index 0000000000..2a430a0c42 --- /dev/null +++ b/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.qlref @@ -0,0 +1 @@ +rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql \ No newline at end of file diff --git a/cpp/common/src/codingstandards/cpp/exclusions/c/RuleMetadata.qll b/cpp/common/src/codingstandards/cpp/exclusions/c/RuleMetadata.qll index 3f52afac5f..0a75bef10e 100644 --- a/cpp/common/src/codingstandards/cpp/exclusions/c/RuleMetadata.qll +++ b/cpp/common/src/codingstandards/cpp/exclusions/c/RuleMetadata.qll @@ -47,6 +47,7 @@ import Strings1 import Strings2 import Strings3 import Syntax +import Types /** The TQuery type representing this language * */ newtype TCQuery = @@ -94,7 +95,8 @@ newtype TCQuery = TStrings1PackageQuery(Strings1Query q) or TStrings2PackageQuery(Strings2Query q) or TStrings3PackageQuery(Strings3Query q) or - TSyntaxPackageQuery(SyntaxQuery q) + TSyntaxPackageQuery(SyntaxQuery q) or + TTypesPackageQuery(TypesQuery q) /** The metadata predicate * */ predicate isQueryMetadata(Query query, string queryId, string ruleId, string category) { @@ -142,5 +144,6 @@ predicate isQueryMetadata(Query query, string queryId, string ruleId, string cat isStrings1QueryMetadata(query, queryId, ruleId, category) or isStrings2QueryMetadata(query, queryId, ruleId, category) or isStrings3QueryMetadata(query, queryId, ruleId, category) or - isSyntaxQueryMetadata(query, queryId, ruleId, category) + isSyntaxQueryMetadata(query, queryId, ruleId, category) or + isTypesQueryMetadata(query, queryId, ruleId, category) } diff --git a/cpp/common/src/codingstandards/cpp/exclusions/c/Types.qll b/cpp/common/src/codingstandards/cpp/exclusions/c/Types.qll index 79cf3550b1..f50d30d5f0 100644 --- a/cpp/common/src/codingstandards/cpp/exclusions/c/Types.qll +++ b/cpp/common/src/codingstandards/cpp/exclusions/c/Types.qll @@ -4,517 +4,92 @@ import RuleMetadata import codingstandards.cpp.exclusions.RuleMetadata newtype TypesQuery = - TPreventOrDetectDomainAndRangeErrorsInMathFunctionsQuery() or - TFloatingPointConversionsNotWithinRangeOfNewTypeQuery() or - TFloatingPointOfIntegralValuesLosePrecisionQuery() or - TObjectReprUsedForComparingFloatingPointValuesQuery() or - TEnsureThatUnsignedIntegerOperationsDoNotWrapQuery() or - TIntConversionCausesLostOrMisinterpretedDataQuery() or - TOperationsOnSignedIntegersResultsInOverflowQuery() or - TDivAndModOperationResultsInDivByZeroQuery() or - TExprShiftedByNegativeBitsOrGreaterThanOperandQuery() or - TUseCorrectIntegerPrecisionsQuery() or - TConvertingAPointerToIntegerOrIntegerToPointerQuery() or - TNumericTypedefsNotUsedInPlaceOfBasicNumericalTypesQuery() or - TOperandsOfAnInappropriateEssentialTypeQuery() or - TCharTypeExprsUsedInAddOrSubQuery() or - TAssignmentToIncompatibleEssentialTypeQuery() or - TArithConversionOperandHasDifferentEssTypeCategoryQuery() or - TValueCastToInappropriateEssentialTypeQuery() or - TCompositeExprValueAssignedToObjWithWiderEssTypeQuery() or - TConvertedCompExprOperandHasWiderEssTypeThanOtherQuery() or - TCompExprValCastToIncompatEssTypeQuery() or - TConstExprEvalCausesUnsignedIntWraparoundQuery() or - TArrayTypeParamAtSizeofOperandQuery() or - TLoopCounterHaveEssentiallyFloatingTypeQuery() or - TCtypeFuncNeitherReprAsUnsignedCharNorEOFQuery() or - TMemcmpUsedToCompareNullTerminatedStringsQuery() or - TMemcpyMemmoveMemcmpArgNotPointerToCompatTypesQuery() or - TMemcmpArgNotPtsToSignedUnsignedBooleanEnumEssTypeQuery() or - TBitFieldsShallOnlyBeDeclaredWithAnAppropriateTypeQuery() or - TSingleBitNamedBitFieldsOfASignedTypeQuery() or - TStringLiteralAssignedToObjPtrToConstQualifiedCharQuery() +TExprShiftedbyNegativeOrGreaterPrecisionOperandQuery() or +TConvertingAPointerToIntegerOrIntegerToPointerQuery() or +TPlainNumericalTypeUsedOverExplicitTypedefQuery() or +TSizeofOperatorUsedOnArrayTypeParamQuery() or +TStringLiteralAssignedToNonConstCharQuery() predicate isTypesQueryMetadata(Query query, string queryId, string ruleId, string category) { query = - // `Query` instance for the `preventOrDetectDomainAndRangeErrorsInMathFunctions` query - TypesPackage::preventOrDetectDomainAndRangeErrorsInMathFunctionsQuery() and + // `Query` instance for the `exprShiftedbyNegativeOrGreaterPrecisionOperand` query + TypesPackage::exprShiftedbyNegativeOrGreaterPrecisionOperandQuery() and queryId = - // `@id` for the `preventOrDetectDomainAndRangeErrorsInMathFunctions` query - "c/cert/prevent-or-detect-domain-and-range-errors-in-math-functions" and - ruleId = "FLP32-C" and - category = "rule" - or - query = - // `Query` instance for the `floatingPointConversionsNotWithinRangeOfNewType` query - TypesPackage::floatingPointConversionsNotWithinRangeOfNewTypeQuery() and - queryId = - // `@id` for the `floatingPointConversionsNotWithinRangeOfNewType` query - "c/cert/floating-point-conversions-not-within-range-of-new-type" and - ruleId = "FLP34-C" and - category = "rule" - or - query = - // `Query` instance for the `floatingPointOfIntegralValuesLosePrecision` query - TypesPackage::floatingPointOfIntegralValuesLosePrecisionQuery() and - queryId = - // `@id` for the `floatingPointOfIntegralValuesLosePrecision` query - "c/cert/floating-point-of-integral-values-lose-precision" and - ruleId = "FLP36-C" and - category = "rule" - or - query = - // `Query` instance for the `objectReprUsedForComparingFloatingPointValues` query - TypesPackage::objectReprUsedForComparingFloatingPointValuesQuery() and - queryId = - // `@id` for the `objectReprUsedForComparingFloatingPointValues` query - "c/cert/object-repr-used-for-comparing-floating-point-values" and - ruleId = "FLP37-C" and - category = "rule" - or - query = - // `Query` instance for the `ensureThatUnsignedIntegerOperationsDoNotWrap` query - TypesPackage::ensureThatUnsignedIntegerOperationsDoNotWrapQuery() and - queryId = - // `@id` for the `ensureThatUnsignedIntegerOperationsDoNotWrap` query - "c/cert/ensure-that-unsigned-integer-operations-do-not-wrap" and - ruleId = "INT30-C" and - category = "rule" - or - query = - // `Query` instance for the `intConversionCausesLostOrMisinterpretedData` query - TypesPackage::intConversionCausesLostOrMisinterpretedDataQuery() and - queryId = - // `@id` for the `intConversionCausesLostOrMisinterpretedData` query - "c/cert/int-conversion-causes-lost-or-misinterpreted-data" and - ruleId = "INT31-C" and - category = "rule" - or - query = - // `Query` instance for the `operationsOnSignedIntegersResultsInOverflow` query - TypesPackage::operationsOnSignedIntegersResultsInOverflowQuery() and - queryId = - // `@id` for the `operationsOnSignedIntegersResultsInOverflow` query - "c/cert/operations-on-signed-integers-results-in-overflow" and - ruleId = "INT32-C" and - category = "rule" - or - query = - // `Query` instance for the `divAndModOperationResultsInDivByZero` query - TypesPackage::divAndModOperationResultsInDivByZeroQuery() and - queryId = - // `@id` for the `divAndModOperationResultsInDivByZero` query - "c/cert/div-and-mod-operation-results-in-div-by-zero" and - ruleId = "INT33-C" and - category = "rule" - or - query = - // `Query` instance for the `exprShiftedByNegativeBitsOrGreaterThanOperand` query - TypesPackage::exprShiftedByNegativeBitsOrGreaterThanOperandQuery() and - queryId = - // `@id` for the `exprShiftedByNegativeBitsOrGreaterThanOperand` query - "c/cert/expr-shifted-by-negative-bits-or-greater-than-operand" and + // `@id` for the `exprShiftedbyNegativeOrGreaterPrecisionOperand` query + "c/cert/expr-shiftedby-negative-or-greater-precision-operand" and ruleId = "INT34-C" and category = "rule" or - query = - // `Query` instance for the `useCorrectIntegerPrecisions` query - TypesPackage::useCorrectIntegerPrecisionsQuery() and - queryId = - // `@id` for the `useCorrectIntegerPrecisions` query - "c/cert/use-correct-integer-precisions" and - ruleId = "INT35-C" and - category = "rule" - or query = // `Query` instance for the `convertingAPointerToIntegerOrIntegerToPointer` query - TypesPackage::convertingAPointerToIntegerOrIntegerToPointerQuery() and + TypesPackage::convertingAPointerToIntegerOrIntegerToPointerQuery() and queryId = // `@id` for the `convertingAPointerToIntegerOrIntegerToPointer` query - "c/cert/converting-a-pointer-to-integer-or-integer-to-pointer" and + "c/cert/converting-a-pointer-to-integer-or-integer-to-pointer" and ruleId = "INT36-C" and category = "rule" or query = - // `Query` instance for the `numericTypedefsNotUsedInPlaceOfBasicNumericalTypes` query - TypesPackage::numericTypedefsNotUsedInPlaceOfBasicNumericalTypesQuery() and + // `Query` instance for the `plainNumericalTypeUsedOverExplicitTypedef` query + TypesPackage::plainNumericalTypeUsedOverExplicitTypedefQuery() and queryId = - // `@id` for the `numericTypedefsNotUsedInPlaceOfBasicNumericalTypes` query - "c/misra/numeric-typedefs-not-used-in-place-of-basic-numerical-types" and + // `@id` for the `plainNumericalTypeUsedOverExplicitTypedef` query + "c/misra/plain-numerical-type-used-over-explicit-typedef" and ruleId = "DIR-4-6" and category = "advisory" or query = - // `Query` instance for the `operandsOfAnInappropriateEssentialType` query - TypesPackage::operandsOfAnInappropriateEssentialTypeQuery() and - queryId = - // `@id` for the `operandsOfAnInappropriateEssentialType` query - "c/misra/operands-of-an-inappropriate-essential-type" and - ruleId = "RULE-10-1" and - category = "required" - or - query = - // `Query` instance for the `charTypeExprsUsedInAddOrSub` query - TypesPackage::charTypeExprsUsedInAddOrSubQuery() and - queryId = - // `@id` for the `charTypeExprsUsedInAddOrSub` query - "c/misra/char-type-exprs-used-in-add-or-sub" and - ruleId = "RULE-10-2" and - category = "required" - or - query = - // `Query` instance for the `assignmentToIncompatibleEssentialType` query - TypesPackage::assignmentToIncompatibleEssentialTypeQuery() and - queryId = - // `@id` for the `assignmentToIncompatibleEssentialType` query - "c/misra/assignment-to-incompatible-essential-type" and - ruleId = "RULE-10-3" and - category = "required" - or - query = - // `Query` instance for the `arithConversionOperandHasDifferentEssTypeCategory` query - TypesPackage::arithConversionOperandHasDifferentEssTypeCategoryQuery() and - queryId = - // `@id` for the `arithConversionOperandHasDifferentEssTypeCategory` query - "c/misra/arith-conversion-operand-has-different-ess-type-category" and - ruleId = "RULE-10-4" and - category = "required" - or - query = - // `Query` instance for the `valueCastToInappropriateEssentialType` query - TypesPackage::valueCastToInappropriateEssentialTypeQuery() and - queryId = - // `@id` for the `valueCastToInappropriateEssentialType` query - "c/misra/value-cast-to-inappropriate-essential-type" and - ruleId = "RULE-10-5" and - category = "advisory" - or - query = - // `Query` instance for the `compositeExprValueAssignedToObjWithWiderEssType` query - TypesPackage::compositeExprValueAssignedToObjWithWiderEssTypeQuery() and + // `Query` instance for the `sizeofOperatorUsedOnArrayTypeParam` query + TypesPackage::sizeofOperatorUsedOnArrayTypeParamQuery() and queryId = - // `@id` for the `compositeExprValueAssignedToObjWithWiderEssType` query - "c/misra/composite-expr-value-assigned-to-obj-with-wider-ess-type" and - ruleId = "RULE-10-6" and - category = "required" - or - query = - // `Query` instance for the `convertedCompExprOperandHasWiderEssTypeThanOther` query - TypesPackage::convertedCompExprOperandHasWiderEssTypeThanOtherQuery() and - queryId = - // `@id` for the `convertedCompExprOperandHasWiderEssTypeThanOther` query - "c/misra/converted-comp-expr-operand-has-wider-ess-type-than-other" and - ruleId = "RULE-10-7" and - category = "required" - or - query = - // `Query` instance for the `compExprValCastToIncompatEssType` query - TypesPackage::compExprValCastToIncompatEssTypeQuery() and - queryId = - // `@id` for the `compExprValCastToIncompatEssType` query - "c/misra/comp-expr-val-cast-to-incompat-ess-type" and - ruleId = "RULE-10-8" and - category = "required" - or - query = - // `Query` instance for the `constExprEvalCausesUnsignedIntWraparound` query - TypesPackage::constExprEvalCausesUnsignedIntWraparoundQuery() and - queryId = - // `@id` for the `constExprEvalCausesUnsignedIntWraparound` query - "c/misra/const-expr-eval-causes-unsigned-int-wraparound" and - ruleId = "RULE-12-4" and - category = "advisory" - or - query = - // `Query` instance for the `arrayTypeParamAtSizeofOperand` query - TypesPackage::arrayTypeParamAtSizeofOperandQuery() and - queryId = - // `@id` for the `arrayTypeParamAtSizeofOperand` query - "c/misra/array-type-param-at-sizeof-operand" and + // `@id` for the `sizeofOperatorUsedOnArrayTypeParam` query + "c/misra/sizeof-operator-used-on-array-type-param" and ruleId = "RULE-12-5" and category = "mandatory" or query = - // `Query` instance for the `loopCounterHaveEssentiallyFloatingType` query - TypesPackage::loopCounterHaveEssentiallyFloatingTypeQuery() and + // `Query` instance for the `stringLiteralAssignedToNonConstChar` query + TypesPackage::stringLiteralAssignedToNonConstCharQuery() and queryId = - // `@id` for the `loopCounterHaveEssentiallyFloatingType` query - "c/misra/loop-counter-have-essentially-floating-type" and - ruleId = "RULE-14-1" and - category = "required" - or - query = - // `Query` instance for the `ctypeFuncNeitherReprAsUnsignedCharNorEOF` query - TypesPackage::ctypeFuncNeitherReprAsUnsignedCharNorEOFQuery() and - queryId = - // `@id` for the `ctypeFuncNeitherReprAsUnsignedCharNorEOF` query - "c/misra/ctype-func-neither-repr-as-unsigned-char-nor-eof" and - ruleId = "RULE-21-13" and - category = "mandatory" - or - query = - // `Query` instance for the `memcmpUsedToCompareNullTerminatedStrings` query - TypesPackage::memcmpUsedToCompareNullTerminatedStringsQuery() and - queryId = - // `@id` for the `memcmpUsedToCompareNullTerminatedStrings` query - "c/misra/memcmp-used-to-compare-null-terminated-strings" and - ruleId = "RULE-21-14" and - category = "required" - or - query = - // `Query` instance for the `memcpyMemmoveMemcmpArgNotPointerToCompatTypes` query - TypesPackage::memcpyMemmoveMemcmpArgNotPointerToCompatTypesQuery() and - queryId = - // `@id` for the `memcpyMemmoveMemcmpArgNotPointerToCompatTypes` query - "c/misra/memcpy-memmove-memcmp-arg-not-pointer-to-compat-types" and - ruleId = "RULE-21-15" and - category = "required" - or - query = - // `Query` instance for the `memcmpArgNotPtsToSignedUnsignedBooleanEnumEssType` query - TypesPackage::memcmpArgNotPtsToSignedUnsignedBooleanEnumEssTypeQuery() and - queryId = - // `@id` for the `memcmpArgNotPtsToSignedUnsignedBooleanEnumEssType` query - "c/misra/memcmp-arg-not-pts-to-signed-unsigned-boolean-enum-ess-type" and - ruleId = "RULE-21-16" and - category = "required" - or - query = - // `Query` instance for the `bitFieldsShallOnlyBeDeclaredWithAnAppropriateType` query - TypesPackage::bitFieldsShallOnlyBeDeclaredWithAnAppropriateTypeQuery() and - queryId = - // `@id` for the `bitFieldsShallOnlyBeDeclaredWithAnAppropriateType` query - "c/misra/bit-fields-shall-only-be-declared-with-an-appropriate-type" and - ruleId = "RULE-6-1" and - category = "required" - or - query = - // `Query` instance for the `singleBitNamedBitFieldsOfASignedType` query - TypesPackage::singleBitNamedBitFieldsOfASignedTypeQuery() and - queryId = - // `@id` for the `singleBitNamedBitFieldsOfASignedType` query - "c/misra/single-bit-named-bit-fields-of-a-signed-type" and - ruleId = "RULE-6-2" and - category = "required" - or - query = - // `Query` instance for the `stringLiteralAssignedToObjPtrToConstQualifiedChar` query - TypesPackage::stringLiteralAssignedToObjPtrToConstQualifiedCharQuery() and - queryId = - // `@id` for the `stringLiteralAssignedToObjPtrToConstQualifiedChar` query - "c/misra/string-literal-assigned-to-obj-ptr-to-const-qualified-char" and + // `@id` for the `stringLiteralAssignedToNonConstChar` query + "c/misra/string-literal-assigned-to-non-const-char" and ruleId = "RULE-7-4" and category = "required" } module TypesPackage { - Query preventOrDetectDomainAndRangeErrorsInMathFunctionsQuery() { - //autogenerate `Query` type - result = - // `Query` type for `preventOrDetectDomainAndRangeErrorsInMathFunctions` query - TQueryC(TTypesPackageQuery(TPreventOrDetectDomainAndRangeErrorsInMathFunctionsQuery())) - } - - Query floatingPointConversionsNotWithinRangeOfNewTypeQuery() { - //autogenerate `Query` type - result = - // `Query` type for `floatingPointConversionsNotWithinRangeOfNewType` query - TQueryC(TTypesPackageQuery(TFloatingPointConversionsNotWithinRangeOfNewTypeQuery())) - } - - Query floatingPointOfIntegralValuesLosePrecisionQuery() { - //autogenerate `Query` type - result = - // `Query` type for `floatingPointOfIntegralValuesLosePrecision` query - TQueryC(TTypesPackageQuery(TFloatingPointOfIntegralValuesLosePrecisionQuery())) - } - - Query objectReprUsedForComparingFloatingPointValuesQuery() { - //autogenerate `Query` type - result = - // `Query` type for `objectReprUsedForComparingFloatingPointValues` query - TQueryC(TTypesPackageQuery(TObjectReprUsedForComparingFloatingPointValuesQuery())) - } - - Query ensureThatUnsignedIntegerOperationsDoNotWrapQuery() { +Query exprShiftedbyNegativeOrGreaterPrecisionOperandQuery() { //autogenerate `Query` type - result = - // `Query` type for `ensureThatUnsignedIntegerOperationsDoNotWrap` query - TQueryC(TTypesPackageQuery(TEnsureThatUnsignedIntegerOperationsDoNotWrapQuery())) - } - - Query intConversionCausesLostOrMisinterpretedDataQuery() { - //autogenerate `Query` type - result = - // `Query` type for `intConversionCausesLostOrMisinterpretedData` query - TQueryC(TTypesPackageQuery(TIntConversionCausesLostOrMisinterpretedDataQuery())) - } - - Query operationsOnSignedIntegersResultsInOverflowQuery() { - //autogenerate `Query` type - result = - // `Query` type for `operationsOnSignedIntegersResultsInOverflow` query - TQueryC(TTypesPackageQuery(TOperationsOnSignedIntegersResultsInOverflowQuery())) - } - - Query divAndModOperationResultsInDivByZeroQuery() { - //autogenerate `Query` type - result = - // `Query` type for `divAndModOperationResultsInDivByZero` query - TQueryC(TTypesPackageQuery(TDivAndModOperationResultsInDivByZeroQuery())) - } - - Query exprShiftedByNegativeBitsOrGreaterThanOperandQuery() { - //autogenerate `Query` type - result = - // `Query` type for `exprShiftedByNegativeBitsOrGreaterThanOperand` query - TQueryC(TTypesPackageQuery(TExprShiftedByNegativeBitsOrGreaterThanOperandQuery())) - } - - Query useCorrectIntegerPrecisionsQuery() { - //autogenerate `Query` type - result = - // `Query` type for `useCorrectIntegerPrecisions` query - TQueryC(TTypesPackageQuery(TUseCorrectIntegerPrecisionsQuery())) - } + result = + // `Query` type for `exprShiftedbyNegativeOrGreaterPrecisionOperand` query + TQueryC(TTypesPackageQuery(TExprShiftedbyNegativeOrGreaterPrecisionOperandQuery())) +} - Query convertingAPointerToIntegerOrIntegerToPointerQuery() { +Query convertingAPointerToIntegerOrIntegerToPointerQuery() { //autogenerate `Query` type - result = + result = // `Query` type for `convertingAPointerToIntegerOrIntegerToPointer` query - TQueryC(TTypesPackageQuery(TConvertingAPointerToIntegerOrIntegerToPointerQuery())) - } - - Query numericTypedefsNotUsedInPlaceOfBasicNumericalTypesQuery() { - //autogenerate `Query` type - result = - // `Query` type for `numericTypedefsNotUsedInPlaceOfBasicNumericalTypes` query - TQueryC(TTypesPackageQuery(TNumericTypedefsNotUsedInPlaceOfBasicNumericalTypesQuery())) - } - - Query operandsOfAnInappropriateEssentialTypeQuery() { - //autogenerate `Query` type - result = - // `Query` type for `operandsOfAnInappropriateEssentialType` query - TQueryC(TTypesPackageQuery(TOperandsOfAnInappropriateEssentialTypeQuery())) - } - - Query charTypeExprsUsedInAddOrSubQuery() { - //autogenerate `Query` type - result = - // `Query` type for `charTypeExprsUsedInAddOrSub` query - TQueryC(TTypesPackageQuery(TCharTypeExprsUsedInAddOrSubQuery())) - } - - Query assignmentToIncompatibleEssentialTypeQuery() { - //autogenerate `Query` type - result = - // `Query` type for `assignmentToIncompatibleEssentialType` query - TQueryC(TTypesPackageQuery(TAssignmentToIncompatibleEssentialTypeQuery())) - } - - Query arithConversionOperandHasDifferentEssTypeCategoryQuery() { - //autogenerate `Query` type - result = - // `Query` type for `arithConversionOperandHasDifferentEssTypeCategory` query - TQueryC(TTypesPackageQuery(TArithConversionOperandHasDifferentEssTypeCategoryQuery())) - } - - Query valueCastToInappropriateEssentialTypeQuery() { - //autogenerate `Query` type - result = - // `Query` type for `valueCastToInappropriateEssentialType` query - TQueryC(TTypesPackageQuery(TValueCastToInappropriateEssentialTypeQuery())) - } - - Query compositeExprValueAssignedToObjWithWiderEssTypeQuery() { - //autogenerate `Query` type - result = - // `Query` type for `compositeExprValueAssignedToObjWithWiderEssType` query - TQueryC(TTypesPackageQuery(TCompositeExprValueAssignedToObjWithWiderEssTypeQuery())) - } - - Query convertedCompExprOperandHasWiderEssTypeThanOtherQuery() { - //autogenerate `Query` type - result = - // `Query` type for `convertedCompExprOperandHasWiderEssTypeThanOther` query - TQueryC(TTypesPackageQuery(TConvertedCompExprOperandHasWiderEssTypeThanOtherQuery())) - } - - Query compExprValCastToIncompatEssTypeQuery() { - //autogenerate `Query` type - result = - // `Query` type for `compExprValCastToIncompatEssType` query - TQueryC(TTypesPackageQuery(TCompExprValCastToIncompatEssTypeQuery())) - } - - Query constExprEvalCausesUnsignedIntWraparoundQuery() { - //autogenerate `Query` type - result = - // `Query` type for `constExprEvalCausesUnsignedIntWraparound` query - TQueryC(TTypesPackageQuery(TConstExprEvalCausesUnsignedIntWraparoundQuery())) - } - - Query arrayTypeParamAtSizeofOperandQuery() { - //autogenerate `Query` type - result = - // `Query` type for `arrayTypeParamAtSizeofOperand` query - TQueryC(TTypesPackageQuery(TArrayTypeParamAtSizeofOperandQuery())) - } - - Query loopCounterHaveEssentiallyFloatingTypeQuery() { - //autogenerate `Query` type - result = - // `Query` type for `loopCounterHaveEssentiallyFloatingType` query - TQueryC(TTypesPackageQuery(TLoopCounterHaveEssentiallyFloatingTypeQuery())) - } - - Query ctypeFuncNeitherReprAsUnsignedCharNorEOFQuery() { - //autogenerate `Query` type - result = - // `Query` type for `ctypeFuncNeitherReprAsUnsignedCharNorEOF` query - TQueryC(TTypesPackageQuery(TCtypeFuncNeitherReprAsUnsignedCharNorEOFQuery())) - } - - Query memcmpUsedToCompareNullTerminatedStringsQuery() { - //autogenerate `Query` type - result = - // `Query` type for `memcmpUsedToCompareNullTerminatedStrings` query - TQueryC(TTypesPackageQuery(TMemcmpUsedToCompareNullTerminatedStringsQuery())) - } - - Query memcpyMemmoveMemcmpArgNotPointerToCompatTypesQuery() { - //autogenerate `Query` type - result = - // `Query` type for `memcpyMemmoveMemcmpArgNotPointerToCompatTypes` query - TQueryC(TTypesPackageQuery(TMemcpyMemmoveMemcmpArgNotPointerToCompatTypesQuery())) - } - - Query memcmpArgNotPtsToSignedUnsignedBooleanEnumEssTypeQuery() { - //autogenerate `Query` type - result = - // `Query` type for `memcmpArgNotPtsToSignedUnsignedBooleanEnumEssType` query - TQueryC(TTypesPackageQuery(TMemcmpArgNotPtsToSignedUnsignedBooleanEnumEssTypeQuery())) - } + TQueryC(TTypesPackageQuery(TConvertingAPointerToIntegerOrIntegerToPointerQuery())) +} - Query bitFieldsShallOnlyBeDeclaredWithAnAppropriateTypeQuery() { +Query plainNumericalTypeUsedOverExplicitTypedefQuery() { //autogenerate `Query` type - result = - // `Query` type for `bitFieldsShallOnlyBeDeclaredWithAnAppropriateType` query - TQueryC(TTypesPackageQuery(TBitFieldsShallOnlyBeDeclaredWithAnAppropriateTypeQuery())) - } + result = + // `Query` type for `plainNumericalTypeUsedOverExplicitTypedef` query + TQueryC(TTypesPackageQuery(TPlainNumericalTypeUsedOverExplicitTypedefQuery())) +} - Query singleBitNamedBitFieldsOfASignedTypeQuery() { +Query sizeofOperatorUsedOnArrayTypeParamQuery() { //autogenerate `Query` type - result = - // `Query` type for `singleBitNamedBitFieldsOfASignedType` query - TQueryC(TTypesPackageQuery(TSingleBitNamedBitFieldsOfASignedTypeQuery())) - } + result = + // `Query` type for `sizeofOperatorUsedOnArrayTypeParam` query + TQueryC(TTypesPackageQuery(TSizeofOperatorUsedOnArrayTypeParamQuery())) +} - Query stringLiteralAssignedToObjPtrToConstQualifiedCharQuery() { +Query stringLiteralAssignedToNonConstCharQuery() { //autogenerate `Query` type - result = - // `Query` type for `stringLiteralAssignedToObjPtrToConstQualifiedChar` query - TQueryC(TTypesPackageQuery(TStringLiteralAssignedToObjPtrToConstQualifiedCharQuery())) - } + result = + // `Query` type for `stringLiteralAssignedToNonConstChar` query + TQueryC(TTypesPackageQuery(TStringLiteralAssignedToNonConstCharQuery())) +} } diff --git a/rule_packages/c/Types.json b/rule_packages/c/Types.json new file mode 100644 index 0000000000..0324a637a3 --- /dev/null +++ b/rule_packages/c/Types.json @@ -0,0 +1,482 @@ +{ + "CERT-C": { + "FLP32-C": { + "properties": { + "obligation": "rule" + }, + "queries": [ + { + "description": "TODO.", + "kind": "problem", + "name": "Prevent or detect domain and range errors in math functions", + "precision": "very-high", + "severity": "error", + "short_name": "PreventOrDetectDomainAndRangeErrorsInMathFunctions", + "tags": [] + } + ], + "title": "Prevent or detect domain and range errors in math functions" + }, + "FLP34-C": { + "properties": { + "obligation": "rule" + }, + "queries": [ + { + "description": "TODO.", + "kind": "problem", + "name": "Ensure that floating-point conversions are within range of the new type", + "precision": "very-high", + "severity": "error", + "short_name": "EnsureThatFloatingPointConversionsAreWithinRangeOf", + "tags": [] + } + ], + "title": "Ensure that floating-point conversions are within range of the new type" + }, + "FLP36-C": { + "properties": { + "obligation": "rule" + }, + "queries": [ + { + "description": "TODO.", + "kind": "problem", + "name": "Preserve precision when converting integral values to floating-point type", + "precision": "very-high", + "severity": "error", + "short_name": "PreservePrecisionWhenConverting", + "tags": [] + } + ], + "title": "Preserve precision when converting integral values to floating-point type" + }, + "FLP37-C": { + "properties": { + "obligation": "rule" + }, + "queries": [ + { + "description": "TODO.", + "kind": "problem", + "name": "Do not use object representations to compare floating-point values", + "precision": "very-high", + "severity": "error", + "short_name": "DoNotUseObjectRepresentations", + "tags": [] + } + ], + "title": "Do not use object representations to compare floating-point values" + }, + "INT30-C": { + "properties": { + "obligation": "rule" + }, + "queries": [ + { + "description": "TODO.", + "kind": "problem", + "name": "Ensure that unsigned integer operations do not wrap", + "precision": "high", + "severity": "error", + "short_name": "EnsureThatUnsigne", + "tags": [] + } + ], + "title": "Ensure that unsigned integer operations do not wrap" + }, + "INT31-C": { + "properties": { + "obligation": "rule" + }, + "queries": [ + { + "description": "TODO.", + "kind": "problem", + "name": "Ensure that integer conversions do not result in lost or misinterpreted data", + "precision": "high", + "severity": "error", + "short_name": "EnsureThatIntegerConversionsD", + "tags": [] + } + ], + "title": "Ensure that integer conversions do not result in lost or misinterpreted data" + }, + "INT32-C": { + "properties": { + "obligation": "rule" + }, + "queries": [ + { + "description": "TODO.", + "kind": "problem", + "name": "Ensure that operations on signed integers do not result in overflow", + "precision": "high", + "severity": "error", + "short_name": "EnsureThatOperationsOnSignedInt", + "tags": [] + } + ], + "title": "Ensure that operations on signed integers do not result in overflow" + }, + "INT33-C": { + "properties": { + "obligation": "rule" + }, + "queries": [ + { + "description": "TODO.", + "kind": "problem", + "name": "Ensure that division and remainder operations do not result in divide-by-zero errors", + "precision": "high", + "severity": "error", + "short_name": "EnsureThatDivisionAndRemainderO", + "tags": [] + } + ], + "title": "Ensure that division and remainder operations do not result in divide-by-zero errors" + }, + "INT34-C": { + "properties": { + "obligation": "rule" + }, + "queries": [ + { + "description": "Shifting an expression by an operand that is negative or of precision greater or equal to that or the another causes representational error.", + "kind": "problem", + "name": "Bit shift should not be done by a negative operand or an operand of greater-or-equal precision than that of another", + "precision": "very-high", + "severity": "error", + "short_name": "ExprShiftedbyNegativeOrGreaterPrecisionOperand", + "tags": [] + } + ], + "title": "Do not shift an expression by a negative number of bits or by greater than or equal to the number of bits that exist in the operand" + }, + "INT35-C": { + "properties": { + "obligation": "rule" + }, + "queries": [ + { + "description": "TODO.", + "kind": "problem", + "name": "Use correct integer precisions", + "precision": "high", + "severity": "error", + "short_name": "UseCorrectIntegerPrecisions", + "tags": [] + } + ], + "title": "Use correct integer precisions" + }, + "INT36-C": { + "properties": { + "obligation": "rule" + }, + "queries": [ + { + "description": "Converting between pointers and integers is not portable and might cause invalid memory access.", + "kind": "problem", + "name": "Do not convert pointers to integers and back", + "precision": "very-high", + "severity": "error", + "short_name": "ConvertingAPointerToIntegerOrIntegerToPointer", + "tags": [] + } + ], + "title": "Converting a pointer to integer or integer to pointer" + } + }, + "MISRA-C-2012": { + "DIR-4-6": { + "properties": { + "obligation": "advisory" + }, + "queries": [ + { + "description": "Using plain numerical types over typedefs with explicit sign and bit counts may lead to confusion on how much bits are allocated for a value.", + "kind": "problem", + "name": "Do not use plain numerical types over typedefs named after their explicit bit layout", + "precision": "high", + "severity": "error", + "short_name": "PlainNumericalTypeUsedOverExplicitTypedef", + "tags": [] + } + ], + "title": "typedefs that indicate size and signedness should be used in place of the basic numerical types" + }, + "RULE-10-1": { + "properties": { + "obligation": "required" + }, + "queries": [ + { + "description": "TODO.", + "kind": "problem", + "name": "Operands shall not be of an inappropriate essential type", + "precision": "high", + "severity": "error", + "short_name": "OperandsOfAnInappropriateEssentialType", + "tags": [] + } + ], + "title": "Operands shall not be of an inappropriate essential type" + }, + "RULE-10-2": { + "properties": { + "obligation": "required" + }, + "queries": [ + { + "description": "Expressions of essentially character type shall not be used inappropriately in addition and subtraction operations.", + "kind": "problem", + "name": "Expressions of essentially character type shall not be used inappropriately in addition and", + "precision": "very-high", + "severity": "error", + "short_name": "ExpressionsOfEssentiallyCharacterTypeUse", + "tags": [] + } + ], + "title": "Expressions of essentially character type shall not be used inappropriately in addition and subtraction operations" + }, + "RULE-10-3": { + "properties": { + "obligation": "required" + }, + "queries": [ + { + "description": "The value of an expression shall not be assigned to an object with a narrower essential type or of a different essential type category.", + "kind": "problem", + "name": "The value of an expression shall not be assigned to an object with a narrower essential type or of a", + "precision": "high", + "severity": "error", + "short_name": "ValueOfAnExpressionAssignedToAnObjectWit", + "tags": [] + } + ], + "title": "The value of an expression shall not be assigned to an object with a narrower essential type or of a different essential type category" + }, + "RULE-10-4": { + "properties": { + "obligation": "required" + }, + "queries": [ + { + "description": "Both operands of an operator in which the usual arithmetic conversions are performed shall have the same essential type category.", + "kind": "problem", + "name": "Both operands of an operator in which the usual arithmetic conversions are performed shall have the", + "precision": "very-high", + "severity": "error", + "short_name": "BothOperandsOfAnOperatorInWhichT", + "tags": [] + } + ], + "title": "Both operands of an operator in which the usual arithmetic conversions are performed shall have the same essential type category" + }, + "RULE-10-5": { + "properties": { + "obligation": "advisory" + }, + "queries": [ + { + "description": "TODO.", + "kind": "problem", + "name": "The value of an expression should not be cast to an inappropriate essential type", + "precision": "very-high", + "severity": "error", + "short_name": "ValueOfAnExpressionShouldNotBe", + "tags": [] + } + ], + "title": "The value of an expression should not be cast to an inappropriate essential type" + }, + "RULE-10-6": { + "properties": { + "obligation": "required" + }, + "queries": [ + { + "description": "TODO.", + "kind": "problem", + "name": "The value of a composite expression shall not be assigned to an object with wider essential type", + "precision": "very-high", + "severity": "error", + "short_name": "ValueOfACompositeExpressionA", + "tags": [] + } + ], + "title": "The value of a composite expression shall not be assigned to an object with wider essential type" + }, + "RULE-10-7": { + "properties": { + "obligation": "required" + }, + "queries": [ + { + "description": "If a composite expression is used as one operand of an operator in which the usual arithmetic conversions are performed then the other operand shall not have wider essential type.", + "kind": "problem", + "name": "If a composite expression is used as one operand of an operator in which the usual arithmetic", + "precision": "very-high", + "severity": "error", + "short_name": "IfACompositeExpressionIsUsedAsOneOperandO", + "tags": [] + } + ], + "title": "If a composite expression is used as one operand of an operator in which the usual arithmetic conversions are performed then the other operand shall not have wider essential type" + }, + "RULE-10-8": { + "properties": { + "obligation": "required" + }, + "queries": [ + { + "description": "The value of a composite expression shall not be cast to a different essential type category or a wider essential type.", + "kind": "problem", + "name": "The value of a composite expression shall not be cast to a different essential type category or a", + "precision": "very-high", + "severity": "error", + "short_name": "ValueOfACompositeExpressionCastTo", + "tags": [] + } + ], + "title": "The value of a composite expression shall not be cast to a different essential type category or a wider essential type" + }, + "RULE-12-4": { + "properties": { + "obligation": "advisory" + }, + "queries": [ + { + "description": "TODO.", + "kind": "problem", + "name": "Evaluation of constant expressions should not lead to unsigned integer wrap-around", + "precision": "very-high", + "severity": "error", + "short_name": "EvaluationOfConstantExpres", + "tags": [] + } + ], + "title": "Evaluation of constant expressions should not lead to unsigned integer wrap-around" + }, + "RULE-12-5": { + "properties": { + "obligation": "mandatory" + }, + "queries": [ + { + "description": "Using sizeof operator on an array type function parameter leads to unintended results.", + "kind": "problem", + "name": "The sizeof operator should not be used on an array type function parameter.", + "precision": "very-high", + "severity": "error", + "short_name": "SizeofOperatorUsedOnArrayTypeParam", + "tags": [] + } + ], + "title": "The sizeof operator shall not have an operand which is a function parameter declared as 'array of type'" + }, + "RULE-14-1": { + "properties": { + "obligation": "required" + }, + "queries": [ + { + "description": "TODO.", + "kind": "problem", + "name": "A loop counter shall not have essentially floating type", + "precision": "high", + "severity": "error", + "short_name": "LoopCounterHaveEssentiallyFloatingType", + "tags": [] + } + ], + "title": "A loop counter shall not have essentially floating type" + }, + "RULE-21-13": { + "properties": { + "obligation": "mandatory" + }, + "queries": [ + { + "description": "Any value passed to a function in shall be representable as an unsigned char or be the value EOF.", + "kind": "problem", + "name": "Any value passed to a function in shall be representable as an unsigned char or be the", + "precision": "very-high", + "severity": "error", + "short_name": "ValuePassedToAFunctionInCtypehN", + "tags": [] + } + ], + "title": "Any value passed to a function in shall be representable as an unsigned char or be the value EOF" + }, + "RULE-21-14": { + "properties": { + "obligation": "required" + }, + "queries": [ + { + "description": "TODO.", + "kind": "problem", + "name": "The Standard Library function memcmp shall not be used to compare null terminated strings", + "precision": "high", + "severity": "error", + "short_name": "StandardLibraryFunctionMemcmp", + "tags": [] + } + ], + "title": "The Standard Library function memcmp shall not be used to compare null terminated strings" + }, + "RULE-21-15": { + "properties": { + "obligation": "required" + }, + "queries": [ + { + "description": "The pointer arguments to the Standard Library functions memcpy, memmove and memcmp shall be pointers to qualified or unqualified versions of compatible types.", + "kind": "problem", + "name": "The pointer arguments to the Standard Library functions memcpy, memmove and memcmp shall be pointers", + "precision": "very-high", + "severity": "error", + "short_name": "PointerArgumentsToTheStandardLibraryFunctionsM", + "tags": [] + } + ], + "title": "The pointer arguments to the Standard Library functions memcpy, memmove and memcmp shall be pointers to qualified or unqualified versions of compatible types" + }, + "RULE-21-16": { + "properties": { + "obligation": "required" + }, + "queries": [ + { + "description": "The pointer arguments to the Standard Library function memcmp shall point to either a pointer type, an essentially signed type, an essentially unsigned type, an essentially Boolean type or an essentially enum type.", + "kind": "problem", + "name": "The pointer arguments to the Standard Library function memcmp shall point to either a pointer type,", + "precision": "very-high", + "severity": "error", + "short_name": "PointerArgumentsToTheStandardLibraryFunctionM", + "tags": [] + } + ], + "title": "The pointer arguments to the Standard Library function memcmp shall point to either a pointer type, an essentially signed type, an essentially unsigned type, an essentially Boolean type or an essentially enum type" + }, + "RULE-7-4": { + "properties": { + "obligation": "required" + }, + "queries": [ + { + "description": "Assigning string literal to a variable with type other than a pointer to const char and modifying it causes undefined behavior .", + "kind": "problem", + "name": "A string literal shall only be assigned to a pointer to const char.", + "precision": "very-high", + "severity": "error", + "short_name": "StringLiteralAssignedToNonConstChar", + "tags": [] + } + ], + "title": "A string literal shall not be assigned to an object unless the object's type is 'pointer to const-qualified char'" + } + } +} From d5259e29a97a65aac9a9215771fc37f0d9f0bece Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Fri, 24 Feb 2023 16:30:03 -0800 Subject: [PATCH 02/53] Create test.c for RULE-12-5 --- .codeql-version | 1 + 1 file changed, 1 insertion(+) create mode 100644 .codeql-version diff --git a/.codeql-version b/.codeql-version new file mode 100644 index 0000000000..a2f50868e6 --- /dev/null +++ b/.codeql-version @@ -0,0 +1 @@ +v2.9.4 From c6682eb316e4805fe7a37fb84537c5ac43f5f2ea Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Fri, 24 Feb 2023 16:32:14 -0800 Subject: [PATCH 03/53] Remove file staged by mistake and really add test.c --- .codeql-version | 1 - c/misra/test/rules/RULE-12-5/test.c | 35 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) delete mode 100644 .codeql-version create mode 100644 c/misra/test/rules/RULE-12-5/test.c diff --git a/.codeql-version b/.codeql-version deleted file mode 100644 index a2f50868e6..0000000000 --- a/.codeql-version +++ /dev/null @@ -1 +0,0 @@ -v2.9.4 diff --git a/c/misra/test/rules/RULE-12-5/test.c b/c/misra/test/rules/RULE-12-5/test.c new file mode 100644 index 0000000000..d1cea0f8e3 --- /dev/null +++ b/c/misra/test/rules/RULE-12-5/test.c @@ -0,0 +1,35 @@ +#include + +void sample(int32_t nums[4], const char string[], int32_t x) { + for (int i = 0; + i < sizeof(nums) / // NON_COMPLIANT: `sizeof` directly invoked on `nums` + sizeof(int32_t); + i++) { + printf("%d\n", nums[i]); + } + + for (int i = 0; + i < sizeof(string) / // NON_COMPLIANT: directly invoked on `string` + sizeof(char); + i++) { + printf("%c", string[i]); + } + + printf("%d\n", sizeof(x)); // COMPLIANT: `x` not a array type parameter + + char local_string[5] = "abcd"; + printf( + "%d\n", + sizeof( + local_string)); // COMPLIANT: `local_string` not a function parameter + + const char *string = (const char *)string; + + for (int i = 0; + i < sizeof(string) / // COMPLIANT: not a parameter access anymore, now a + // const char* variable declared in the body + sizeof(char); + i++) { + printf("%c", string[i]); + } +} \ No newline at end of file From 6b57f8dbcb1ed6a6b87a4bc638960396dbf1ef75 Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Mon, 27 Feb 2023 10:51:19 -0800 Subject: [PATCH 04/53] Remove bogus case and make `test.c` compile --- c/misra/test/rules/RULE-12-5/test.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/c/misra/test/rules/RULE-12-5/test.c b/c/misra/test/rules/RULE-12-5/test.c index d1cea0f8e3..4b04644ef3 100644 --- a/c/misra/test/rules/RULE-12-5/test.c +++ b/c/misra/test/rules/RULE-12-5/test.c @@ -1,4 +1,5 @@ #include +#include void sample(int32_t nums[4], const char string[], int32_t x) { for (int i = 0; @@ -15,21 +16,13 @@ void sample(int32_t nums[4], const char string[], int32_t x) { printf("%c", string[i]); } - printf("%d\n", sizeof(x)); // COMPLIANT: `x` not a array type parameter + printf("%lu\n", sizeof(x)); // COMPLIANT: `x` not a array type parameter char local_string[5] = "abcd"; printf( - "%d\n", + "%lu\n", sizeof( local_string)); // COMPLIANT: `local_string` not a function parameter +} - const char *string = (const char *)string; - - for (int i = 0; - i < sizeof(string) / // COMPLIANT: not a parameter access anymore, now a - // const char* variable declared in the body - sizeof(char); - i++) { - printf("%c", string[i]); - } -} \ No newline at end of file +int main() { return 0; } \ No newline at end of file From 405f28bbd814f1dc9a5e4772de824c3605f95999 Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Mon, 27 Feb 2023 15:03:35 -0800 Subject: [PATCH 05/53] Remove bogus files --- .../RULE-12-5/SizeofOperatorHaveAnOperan.ql | 19 ------------------- .../SizeofOperatorHaveAnOperan.expected | 1 - .../SizeofOperatorHaveAnOperan.qlref | 1 - 3 files changed, 21 deletions(-) delete mode 100644 c/misra/src/rules/RULE-12-5/SizeofOperatorHaveAnOperan.ql delete mode 100644 c/misra/test/rules/RULE-12-5/SizeofOperatorHaveAnOperan.expected delete mode 100644 c/misra/test/rules/RULE-12-5/SizeofOperatorHaveAnOperan.qlref diff --git a/c/misra/src/rules/RULE-12-5/SizeofOperatorHaveAnOperan.ql b/c/misra/src/rules/RULE-12-5/SizeofOperatorHaveAnOperan.ql deleted file mode 100644 index 46b1ffc740..0000000000 --- a/c/misra/src/rules/RULE-12-5/SizeofOperatorHaveAnOperan.ql +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @id c/misra/sizeof-operator-have-an-operan - * @name RULE-12-5: The sizeof operator shall not have an operand which is a function parameter declared as 'array of - * @description The sizeof operator shall not have an operand which is a function parameter declared - * as 'array of type'. - * @kind problem - * @precision very-high - * @problem.severity error - * @tags external/misra/id/rule-12-5 - * external/misra/obligation/mandatory - */ - -import cpp -import codingstandards.c.misra - -from -where - not isExcluded(x, TypesPackage::sizeofOperatorHaveAnOperanQuery()) and -select diff --git a/c/misra/test/rules/RULE-12-5/SizeofOperatorHaveAnOperan.expected b/c/misra/test/rules/RULE-12-5/SizeofOperatorHaveAnOperan.expected deleted file mode 100644 index 2ec1a0ac6c..0000000000 --- a/c/misra/test/rules/RULE-12-5/SizeofOperatorHaveAnOperan.expected +++ /dev/null @@ -1 +0,0 @@ -No expected results have yet been specified \ No newline at end of file diff --git a/c/misra/test/rules/RULE-12-5/SizeofOperatorHaveAnOperan.qlref b/c/misra/test/rules/RULE-12-5/SizeofOperatorHaveAnOperan.qlref deleted file mode 100644 index 2986a9fda3..0000000000 --- a/c/misra/test/rules/RULE-12-5/SizeofOperatorHaveAnOperan.qlref +++ /dev/null @@ -1 +0,0 @@ -rules/RULE-12-5/SizeofOperatorHaveAnOperan.ql \ No newline at end of file From d8cd0bf1099a431cf768eab24648a8e0256e27ac Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Mon, 27 Feb 2023 15:10:26 -0800 Subject: [PATCH 06/53] Implement RULE-12-5 --- .../RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.ql | 11 ++++++++--- .../SizeofOperatorUsedOnArrayTypeParam.expected | 3 ++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/c/misra/src/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.ql b/c/misra/src/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.ql index e5a212b033..ad1dba6df4 100644 --- a/c/misra/src/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.ql +++ b/c/misra/src/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.ql @@ -13,7 +13,12 @@ import cpp import codingstandards.c.misra -from +from SizeofExprOperator sizeof where - not isExcluded(x, TypesPackage::sizeofOperatorUsedOnArrayTypeParamQuery()) and -select + not isExcluded(sizeof, TypesPackage::sizeofOperatorUsedOnArrayTypeParamQuery()) and + exists(Parameter param | + sizeof.getExprOperand().(VariableAccess).getTarget() = param and + param.getType() instanceof ArrayType + ) +select sizeof, + "The sizeof operator is called on an array-type parameter " + sizeof.getExprOperand() + "." diff --git a/c/misra/test/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.expected b/c/misra/test/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.expected index 2ec1a0ac6c..777df8349a 100644 --- a/c/misra/test/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.expected +++ b/c/misra/test/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.expected @@ -1 +1,2 @@ -No expected results have yet been specified \ No newline at end of file +| test.c:6:12:6:23 | sizeof() | The sizeof operator is called on an array-type parameter nums. | +| test.c:13:12:13:25 | sizeof() | The sizeof operator is called on an array-type parameter string. | \ No newline at end of file From 3a3eba22876db1c424eb590de5bc10bb193af74e Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Mon, 27 Feb 2023 15:38:32 -0800 Subject: [PATCH 07/53] Remove bogus files for RULE-7-4 --- .../StringLiteralAssignedToAnObject.ql | 19 ------------------- .../StringLiteralAssignedToAnObject.expected | 1 - .../StringLiteralAssignedToAnObject.qlref | 1 - 3 files changed, 21 deletions(-) delete mode 100644 c/misra/src/rules/RULE-7-4/StringLiteralAssignedToAnObject.ql delete mode 100644 c/misra/test/rules/RULE-7-4/StringLiteralAssignedToAnObject.expected delete mode 100644 c/misra/test/rules/RULE-7-4/StringLiteralAssignedToAnObject.qlref diff --git a/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToAnObject.ql b/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToAnObject.ql deleted file mode 100644 index 5842903f79..0000000000 --- a/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToAnObject.ql +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @id c/misra/string-literal-assigned-to-an-object - * @name RULE-7-4: A string literal shall not be assigned to an object unless the object's type is 'pointer to - * @description A string literal shall not be assigned to an object unless the object's type is - * 'pointer to const-qualified char'. - * @kind problem - * @precision very-high - * @problem.severity error - * @tags external/misra/id/rule-7-4 - * external/misra/obligation/required - */ - -import cpp -import codingstandards.c.misra - -from -where - not isExcluded(x, TypesPackage::stringLiteralAssignedToAnObjectQuery()) and -select diff --git a/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToAnObject.expected b/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToAnObject.expected deleted file mode 100644 index 2ec1a0ac6c..0000000000 --- a/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToAnObject.expected +++ /dev/null @@ -1 +0,0 @@ -No expected results have yet been specified \ No newline at end of file diff --git a/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToAnObject.qlref b/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToAnObject.qlref deleted file mode 100644 index b48e298e04..0000000000 --- a/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToAnObject.qlref +++ /dev/null @@ -1 +0,0 @@ -rules/RULE-7-4/StringLiteralAssignedToAnObject.ql \ No newline at end of file From 3034493b683f9d1df2a7d9e6bec383423a4bfd6e Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Mon, 27 Feb 2023 17:00:49 -0800 Subject: [PATCH 08/53] Remove main --- c/misra/test/rules/RULE-12-5/test.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/c/misra/test/rules/RULE-12-5/test.c b/c/misra/test/rules/RULE-12-5/test.c index 4b04644ef3..79920737e9 100644 --- a/c/misra/test/rules/RULE-12-5/test.c +++ b/c/misra/test/rules/RULE-12-5/test.c @@ -23,6 +23,4 @@ void sample(int32_t nums[4], const char string[], int32_t x) { "%lu\n", sizeof( local_string)); // COMPLIANT: `local_string` not a function parameter -} - -int main() { return 0; } \ No newline at end of file +} \ No newline at end of file From 25286ad48f031a3773576d97b8834ab8b9c904c3 Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Mon, 27 Feb 2023 17:01:15 -0800 Subject: [PATCH 09/53] Add test.c for RULE-7-4 --- c/misra/test/rules/RULE-7-4/test.c | 55 ++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 c/misra/test/rules/RULE-7-4/test.c diff --git a/c/misra/test/rules/RULE-7-4/test.c b/c/misra/test/rules/RULE-7-4/test.c new file mode 100644 index 0000000000..f4c713324c --- /dev/null +++ b/c/misra/test/rules/RULE-7-4/test.c @@ -0,0 +1,55 @@ +#include + +void sample1() { + const char *s1 = + "string"; // COMPLIANT: string literal assigned to a const char* variable + const register volatile char *s2 = + "string"; // COMPLIANT: string literal assigned to a const char* variable, + // don't care about the qualifiers + char *s3 = + "string"; // NON_COMPLIANT: string literal assigned to a char* variable + s2 = s3; // COMPLIANT: string literal assigned to a char* variable + s3 = s2; // NON_COMPLIANT: string literal assigned to a char* variable +} + +const char *sample2(int x) { + if (x == 1) + return "string"; // COMPLIANT: can return a string literal with return type + // being const char* being const char* + else + return NULL; +} + +char *sample3(int x) { + if (x == 1) + return "string"; // NON_COMPLIANT: can return a string literal with return + // type being char* + else + return NULL; +} + +const char *sample6(int x) { + const char *result; + if (x == 1) + result = "string"; // COMPLIANT: string literal assigned to a const char* + // variable + else + result = NULL; + + return result; // COMPLIANT: `result` can be a string literal with return type + // being const char* +} + +void sample4(char *string) {} + +void sample5(const char *string) {} + +void call45() { + const char *literal = "string"; + sample4(literal); // NON_COMPLIANT: can't pass string literal to char* + sample4("string"); // NON_COMPLIANT: can't pass string literal to char* + sample5(literal); // COMPLIANT: passing string literal to const char* + sample5("string"); // COMPLIANT: passing string literal to const char* +} + +int main() { return 0; } \ No newline at end of file From 14350d0ed44e65ed5dfbc893ee9108d55ceab39e Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Tue, 28 Feb 2023 11:55:51 -0800 Subject: [PATCH 10/53] modified test.c for 7-4 --- c/misra/test/rules/RULE-7-4/test.c | 35 ++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/c/misra/test/rules/RULE-7-4/test.c b/c/misra/test/rules/RULE-7-4/test.c index f4c713324c..88ea54e611 100644 --- a/c/misra/test/rules/RULE-7-4/test.c +++ b/c/misra/test/rules/RULE-7-4/test.c @@ -6,10 +6,12 @@ void sample1() { const register volatile char *s2 = "string"; // COMPLIANT: string literal assigned to a const char* variable, // don't care about the qualifiers - char *s3 = - "string"; // NON_COMPLIANT: string literal assigned to a char* variable - s2 = s3; // COMPLIANT: string literal assigned to a char* variable - s3 = s2; // NON_COMPLIANT: string literal assigned to a char* variable + char *s3 = "string"; // NON_COMPLIANT: char* variable declared to hold a + // string literal + s3 = "string"; // NON_COMPLIANT: string literal assigned to a char* variable + s2 = s3; // COMPLIANT: string literal (rvalue) assigned to a char* variable + s3 = + s2; // NON_COMPLIANT: string literal (rvalue) assigned to a char* variable } const char *sample2(int x) { @@ -28,7 +30,7 @@ char *sample3(int x) { return NULL; } -const char *sample6(int x) { +const char *sample4(int x) { const char *result; if (x == 1) result = "string"; // COMPLIANT: string literal assigned to a const char* @@ -40,16 +42,27 @@ const char *sample6(int x) { // being const char* } -void sample4(char *string) {} +char *sample5(int x) { + const char *result; + if (x == 1) + result = "string"; // COMPLIANT: string literal assigned to a const char* + // variable + else + result = NULL; + + return result; // NON_COMPLIANT: `result` can be a string literal with return + // type being char* +} +void sample6(char *string) {} -void sample5(const char *string) {} +void sample7(const char *string) {} void call45() { const char *literal = "string"; - sample4(literal); // NON_COMPLIANT: can't pass string literal to char* - sample4("string"); // NON_COMPLIANT: can't pass string literal to char* - sample5(literal); // COMPLIANT: passing string literal to const char* - sample5("string"); // COMPLIANT: passing string literal to const char* + sample6(literal); // NON_COMPLIANT: can't pass string literal to char* + sample6("string"); // NON_COMPLIANT: can't pass string literal to char* + sample7(literal); // COMPLIANT: passing string literal to const char* + sample7("string"); // COMPLIANT: passing string literal to const char* } int main() { return 0; } \ No newline at end of file From 2ebcf85c007d3126798d8c263edaff0a4621916e Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Tue, 28 Feb 2023 13:44:11 -0800 Subject: [PATCH 11/53] Slim down test.c for 7-4 --- c/misra/test/rules/RULE-7-4/test.c | 37 ++++-------------------------- 1 file changed, 4 insertions(+), 33 deletions(-) diff --git a/c/misra/test/rules/RULE-7-4/test.c b/c/misra/test/rules/RULE-7-4/test.c index 88ea54e611..5771f846c9 100644 --- a/c/misra/test/rules/RULE-7-4/test.c +++ b/c/misra/test/rules/RULE-7-4/test.c @@ -8,10 +8,6 @@ void sample1() { // don't care about the qualifiers char *s3 = "string"; // NON_COMPLIANT: char* variable declared to hold a // string literal - s3 = "string"; // NON_COMPLIANT: string literal assigned to a char* variable - s2 = s3; // COMPLIANT: string literal (rvalue) assigned to a char* variable - s3 = - s2; // NON_COMPLIANT: string literal (rvalue) assigned to a char* variable } const char *sample2(int x) { @@ -30,39 +26,14 @@ char *sample3(int x) { return NULL; } -const char *sample4(int x) { - const char *result; - if (x == 1) - result = "string"; // COMPLIANT: string literal assigned to a const char* - // variable - else - result = NULL; - - return result; // COMPLIANT: `result` can be a string literal with return type - // being const char* -} - -char *sample5(int x) { - const char *result; - if (x == 1) - result = "string"; // COMPLIANT: string literal assigned to a const char* - // variable - else - result = NULL; - - return result; // NON_COMPLIANT: `result` can be a string literal with return - // type being char* -} -void sample6(char *string) {} +void sample4(char *string) {} -void sample7(const char *string) {} +void sample5(const char *string) {} void call45() { const char *literal = "string"; - sample6(literal); // NON_COMPLIANT: can't pass string literal to char* - sample6("string"); // NON_COMPLIANT: can't pass string literal to char* - sample7(literal); // COMPLIANT: passing string literal to const char* - sample7("string"); // COMPLIANT: passing string literal to const char* + sample4("string"); // NON_COMPLIANT: can't pass string literal to char* + sample5("string"); // COMPLIANT: passing string literal to const char* } int main() { return 0; } \ No newline at end of file From 16fe159244612517732a654b2e9d23117f103b40 Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Tue, 28 Feb 2023 13:51:25 -0800 Subject: [PATCH 12/53] Draft of 7-4 --- .../StringLiteralAssignedToNonConstChar.ql | 87 ++++++++++++++++++- c/misra/test/rules/RULE-7-4/test.c | 27 +++--- 2 files changed, 99 insertions(+), 15 deletions(-) diff --git a/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql b/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql index cf92446bca..73d91df642 100644 --- a/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql +++ b/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql @@ -13,7 +13,88 @@ import cpp import codingstandards.c.misra -from +class NonConstCharStarType extends Type { + NonConstCharStarType() { + this instanceof CharPointerType and + not this.isDeeplyConstBelow() + } +} + +/* A non-const-char* variable declared with a string literal */ +predicate declaringNonConstCharVar(Variable decl) { + not decl instanceof Parameter and // exclude parameters + /* It should be declaring a char* type variable */ + decl.getUnspecifiedType() instanceof CharPointerType and + not decl.getUnderlyingType().isDeeplyConstBelow() and + /* But it's declared to hold a string literal. */ + decl.getInitializer().getExpr() instanceof StringLiteral +} + +/* String literal being assigned to a non-const-char* variable */ +predicate assignmentToNonConstCharVar(Assignment assign) { + /* The variable being assigned is char* */ + assign.getLValue().getUnderlyingType() instanceof NonConstCharStarType and + /* But the rvalue is a string literal */ + exists(Expr rvalue | rvalue = assign.getRValue() | rvalue instanceof StringLiteral) +} + +/* String literal being passed to a non-const-char* parameter */ +predicate assignmentToNonConstCharParam(FunctionCall call) { + exists(int index | + /* Param at index is a char* */ + call.getTarget().getParameter(index).getUnderlyingType() instanceof NonConstCharStarType and + /* But a string literal is passed */ + call.getArgument(index) instanceof StringLiteral + ) +} + +/* String literal being returned by a non-const-char* function */ +predicate returningNonConstCharVar(ReturnStmt return) { + /* The function is declared to return a char* */ + return.getEnclosingFunction().getType().resolveTypedefs() instanceof NonConstCharStarType and + /* But in reality it returns a string literal */ + return.getExpr() instanceof StringLiteral +} + +// newtype TProblematicElem = +// TVar(Variable decl) or +// TAssign(Assignment assign) or +// TFunCall(FunctionCall call) or +// TReturnStmt(ReturnStmt return) +// class ProblematicElem extends TProblematicElem { +// Variable getVariable() { this = TVar(result) } +// Assignment getAssign() { this = TAssign(result) } +// FunctionCall getFunCall() { this = TFunCall(result) } +// ReturnStmt getReturnStmt() { this = TReturnStmt(result) } +// override string toString() { +// this instanceof TVar and result = this.getVariable().toString() +// or +// this instanceof TAssign and result = this.getAssign().toString() +// or +// this instanceof TFunCall and result = this.getFunCall().toString() +// or +// this instanceof TReturnStmt and result = this.getReturnStmt().toString() +// } +// } +// class ProblematicElem = Variable or Assignment or FunctionCall or ReturnStmt; +// ^ Nope! +from Variable decl, Assignment assign, FunctionCall call, ReturnStmt return, string message where - not isExcluded(x, TypesPackage::stringLiteralAssignedToNonConstCharQuery()) and -select + not isExcluded(decl, TypesPackage::stringLiteralAssignedToNonConstCharQuery()) and + not isExcluded(assign, TypesPackage::stringLiteralAssignedToNonConstCharQuery()) and + not isExcluded(call, TypesPackage::stringLiteralAssignedToNonConstCharQuery()) and + not isExcluded(return, TypesPackage::stringLiteralAssignedToNonConstCharQuery()) and + ( + declaringNonConstCharVar(decl) and + message = "char* variable " + decl + " is declared with a string literal." + or + assignmentToNonConstCharVar(assign) and + message = "char* variable " + assign.getLValue() + " is assigned a string literal. " + or + assignmentToNonConstCharParam(call) and + message = "char* parameter of " + call.getTarget() + " is passed a string literal." + or + returningNonConstCharVar(return) and + message = "char* function " + return.getEnclosingFunction() + " is returning a string literal." + ) +select message diff --git a/c/misra/test/rules/RULE-7-4/test.c b/c/misra/test/rules/RULE-7-4/test.c index 5771f846c9..fe2afb9444 100644 --- a/c/misra/test/rules/RULE-7-4/test.c +++ b/c/misra/test/rules/RULE-7-4/test.c @@ -2,26 +2,29 @@ void sample1() { const char *s1 = - "string"; // COMPLIANT: string literal assigned to a const char* variable + "string1"; // COMPLIANT: string literal assigned to a const char* variable const register volatile char *s2 = - "string"; // COMPLIANT: string literal assigned to a const char* variable, - // don't care about the qualifiers - char *s3 = "string"; // NON_COMPLIANT: char* variable declared to hold a - // string literal + "string2"; // COMPLIANT: string literal assigned to a const char* + // variable, don't care about the qualifiers + char *s3 = "string3"; // NON_COMPLIANT: char* variable declared to hold a + // string literal + s3 = + "string4"; // NON_COMPLIANT: char* variable assigned a string literal + // (not likely to be seen in production, since there is strcpy) } const char *sample2(int x) { if (x == 1) - return "string"; // COMPLIANT: can return a string literal with return type - // being const char* being const char* + return "string5"; // COMPLIANT: can return a string literal with return type + // being const char* being const char* else return NULL; } char *sample3(int x) { if (x == 1) - return "string"; // NON_COMPLIANT: can return a string literal with return - // type being char* + return "string6"; // NON_COMPLIANT: can return a string literal with return + // type being char* else return NULL; } @@ -31,9 +34,9 @@ void sample4(char *string) {} void sample5(const char *string) {} void call45() { - const char *literal = "string"; - sample4("string"); // NON_COMPLIANT: can't pass string literal to char* - sample5("string"); // COMPLIANT: passing string literal to const char* + const char *literal = "string7"; + sample4("string8"); // NON_COMPLIANT: can't pass string literal to char* + sample5("string9"); // COMPLIANT: passing string literal to const char* } int main() { return 0; } \ No newline at end of file From b51ac0e7b9b118d56768e510933aeb7c2c3d6fdc Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Tue, 28 Feb 2023 13:52:28 -0800 Subject: [PATCH 13/53] Update .expected for 7-4 --- .../RULE-7-4/StringLiteralAssignedToNonConstChar.expected | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.expected b/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.expected index 2ec1a0ac6c..379a5659fd 100644 --- a/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.expected +++ b/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.expected @@ -1 +1,4 @@ -No expected results have yet been specified \ No newline at end of file +| char* function sample3 is returning a string literal. | +| char* parameter of sample4 is passed a string literal. | +| char* variable s3 is assigned a string literal. | +| char* variable s3 is declared with a string literal. | From ccf9f5f9654c801c0325eb7da985d256dae4c9aa Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Tue, 28 Feb 2023 15:14:25 -0800 Subject: [PATCH 14/53] Remove bogus files --- .../test/rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.expected | 1 - 1 file changed, 1 deletion(-) delete mode 100644 c/misra/test/rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.expected diff --git a/c/misra/test/rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.expected b/c/misra/test/rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.expected deleted file mode 100644 index 2ec1a0ac6c..0000000000 --- a/c/misra/test/rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.expected +++ /dev/null @@ -1 +0,0 @@ -No expected results have yet been specified \ No newline at end of file From ccfeb0630838cba8be7724081b408732506ab3c7 Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Tue, 28 Feb 2023 15:14:46 -0800 Subject: [PATCH 15/53] Remove bogus file --- c/misra/test/rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.qlref | 1 - 1 file changed, 1 deletion(-) delete mode 100644 c/misra/test/rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.qlref diff --git a/c/misra/test/rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.qlref b/c/misra/test/rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.qlref deleted file mode 100644 index 9a6e2990cd..0000000000 --- a/c/misra/test/rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.qlref +++ /dev/null @@ -1 +0,0 @@ -rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.ql \ No newline at end of file From 7e837dc9a92e1f076a9008be0d814c626532401b Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Tue, 28 Feb 2023 15:15:06 -0800 Subject: [PATCH 16/53] Add test cases for DIR-4-6 --- c/misra/test/rules/DIR-4-6/test.c | 71 +++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 c/misra/test/rules/DIR-4-6/test.c diff --git a/c/misra/test/rules/DIR-4-6/test.c b/c/misra/test/rules/DIR-4-6/test.c new file mode 100644 index 0000000000..4762eea2a2 --- /dev/null +++ b/c/misra/test/rules/DIR-4-6/test.c @@ -0,0 +1,71 @@ +#include + +typedef signed char INT8; // COMPLIANT: exception, typedefs are permitted +typedef unsigned char UINT8; // COMPLIANT: exception, typedefs are permitted + +typedef short _INT16; // COMPLIANT: exception, typedefs are permitted +typedef signed short INT16; // COMPLIANT: exception, typedefs are permitted +typedef unsigned short UINT16; // COMPLIANT: exception, typedefs are permitted + +typedef int _INT32; // COMPLIANT: exception, typedefs are permitted +typedef signed int INT32; // COMPLIANT: exception, typedefs are permitted +typedef unsigned int UINT32; // COMPLIANT: exception, typedefs are permitted + +typedef long _INT64; // COMPLIANT: exception, typedefs are permitted +typedef signed long INT64; // COMPLIANT: exception, typedefs are permitted +typedef unsigned long UINT64; // COMPLIANT: exception, typedefs are permitted + +typedef long long _INT128; // COMPLIANT: exception, typedefs are permitted +typedef signed long long INT128; // COMPLIANT: exception, typedefs are permitted +typedef unsigned long long + UINT128; // COMPLIANT: exception, typedefs are permitted + +typedef float FLOAT32; // COMPLIANT: exception, typedefs are permitted +typedef double FLOAT64; // COMPLIANT: exception, typedefs are permitted +typedef long double FLOAT128; // COMPLIANT: exception, typedefs are permitted + +typedef int8_t + astronomical_number_t; // COMPLIANT: aliasing a fixed-width numeric typedef +typedef uint8_t u_astronomical_number_t; // COMPLIANT: aliasing a fixed-width + // numeric typedef +typedef int + astronomical_number_t; // NON_COMPLIANT: aliasing a basic numeric type + +int // COMPLIANT: exception, main's return type can be plain int +main(int argc, // COMPLIANT: exception, argc's type can be plain int + char *argv[]) { // COMPLIANT: char is not a basic numeric type + + char c1 = 1; // COMPLIANT: char is not a basic numeric type + signed char c2 = 1; // NON_COMPLIANT: use typedef int8_t in stdint + unsigned char c3 = 1; // NON_COMPLIANT: use typedef uint8_t in stdint + INT8 c4 = 1; // COMPLIANT: typedef used instead + + short s1 = 1; // NON_COMPLIANT: short is a basic numeric type + signed short s2 = 1; // NON_COMPLIANT: use typedef int16_t in stdint + unsigned short s3 = 1; // NON_COMPLIANT: use typedef uint16_t in stdint + INT16 s4 = 1; // COMPLIANT: typedef used instead + + int i1 = 1; // NON_COMPLIANT: int is a basic numeric type + signed int i2 = 1; // NON_COMPLIANT: use typedef int32_t in stdint + unsigned int i3 = 1; // NON_COMPLIANT: use typedef uint32_t in stdint + INT32 s4 = 1; // COMPLIANT: typedef used instead + + long l1 = 1; // NON_COMPLIANT: int is a basic numeric type + signed long l2 = 1; // NON_COMPLIANT: use typedef int64_t in stdint + unsigned long l3 = 1; // NON_COMPLIANT: use typedef uint64_t in stdint + INT64 s4 = 1; // COMPLIANT: typedef used instead + + long long l1 = 1; // NON_COMPLIANT: int is a basic numeric type + signed long long l2 = 1; // NON_COMPLIANT: use typedef int128_t in stdint + unsigned long long l3 = 1; // NON_COMPLIANT: use typedef uint128_t in stdint + INT128 s4 = 1; // COMPLIANT: typedef used instead + + float f1 = 1; // NON_COMPLIANT: float is a basic numeric type, use a typedef + FLOAT32 f2 = 1; // COMPLIANT: typedef used instead + + double d1 = 1; // NON_COMPLIANT: int is a basic numeric type + FLOAT64 d2 = 1; // COMPLIANT: typedef used instead + + long double ld1 = 1; // NON_COMPLIANT: int is a basic numeric type + FLOAT128 ld2 = 1; // COMPLIANT: typedef used instead +} \ No newline at end of file From 87a0a3df9407d2820a245794e5b808b9317a6886 Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Tue, 28 Feb 2023 16:29:55 -0800 Subject: [PATCH 17/53] Draft of 4-6 --- ...ainNumericalTypeUsedOverExplicitTypedef.ql | 41 +++++++++- c/misra/test/rules/DIR-4-6/test.c | 77 +++++++++---------- 2 files changed, 73 insertions(+), 45 deletions(-) diff --git a/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql b/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql index 7e420aa1a3..4d36edb35a 100644 --- a/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql +++ b/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql @@ -13,7 +13,40 @@ import cpp import codingstandards.c.misra -from -where - not isExcluded(x, TypesPackage::plainNumericalTypeUsedOverExplicitTypedefQuery()) and -select +abstract class ForbiddenType extends Type { } + +class BuiltinNumericType extends ForbiddenType { + BuiltinNumericType() { + /* Exclude the plain char because it does not count as a numeric type */ + this.(CharType).isExplicitlySigned() + or + this.(CharType).isExplicitlyUnsigned() + or + this instanceof ShortType + or + this instanceof IntType + or + this instanceof LongType + or + this instanceof LongLongType + or + this instanceof FloatType + or + this instanceof DoubleType + or + this instanceof LongDoubleType + } +} + +class ForbiddenTypedefType extends ForbiddenType, TypedefType { + ForbiddenTypedefType() { + this.(TypedefType).getBaseType() instanceof BuiltinNumericType and + not this.getName().regexpMatch("u?(int|float)(4|8|16|32|64|128)_t") + } +} + +/* TODO: BuiltinNumericType not being flagged */ +from ForbiddenType forbiddenType +where not isExcluded(forbiddenType, TypesPackage::plainNumericalTypeUsedOverExplicitTypedefQuery()) +select forbiddenType, + "The type " + forbiddenType + " is not a fixed-width numeric type nor an alias to one." diff --git a/c/misra/test/rules/DIR-4-6/test.c b/c/misra/test/rules/DIR-4-6/test.c index 4762eea2a2..b806b91c08 100644 --- a/c/misra/test/rules/DIR-4-6/test.c +++ b/c/misra/test/rules/DIR-4-6/test.c @@ -1,71 +1,66 @@ -#include +typedef signed char int8_t; // COMPLIANT: exception, typedefs are permitted +typedef unsigned char uint8_t; // COMPLIANT: exception, typedefs are permitted -typedef signed char INT8; // COMPLIANT: exception, typedefs are permitted -typedef unsigned char UINT8; // COMPLIANT: exception, typedefs are permitted +typedef signed short int16_t; // COMPLIANT: exception, typedefs are permitted +typedef unsigned short uint16_t; // COMPLIANT: exception, typedefs are permitted -typedef short _INT16; // COMPLIANT: exception, typedefs are permitted -typedef signed short INT16; // COMPLIANT: exception, typedefs are permitted -typedef unsigned short UINT16; // COMPLIANT: exception, typedefs are permitted +typedef signed int int32_t; // COMPLIANT: exception, typedefs are permitted +typedef unsigned int uint32_t; // COMPLIANT: exception, typedefs are permitted -typedef int _INT32; // COMPLIANT: exception, typedefs are permitted -typedef signed int INT32; // COMPLIANT: exception, typedefs are permitted -typedef unsigned int UINT32; // COMPLIANT: exception, typedefs are permitted +typedef signed long int64_t; // COMPLIANT: exception, typedefs are permitted +typedef unsigned long uint64_t; // COMPLIANT: exception, typedefs are permitted -typedef long _INT64; // COMPLIANT: exception, typedefs are permitted -typedef signed long INT64; // COMPLIANT: exception, typedefs are permitted -typedef unsigned long UINT64; // COMPLIANT: exception, typedefs are permitted - -typedef long long _INT128; // COMPLIANT: exception, typedefs are permitted -typedef signed long long INT128; // COMPLIANT: exception, typedefs are permitted +typedef signed long long + int128_t; // COMPLIANT: exception, typedefs are permitted typedef unsigned long long - UINT128; // COMPLIANT: exception, typedefs are permitted + uint128_t; // COMPLIANT: exception, typedefs are permitted -typedef float FLOAT32; // COMPLIANT: exception, typedefs are permitted -typedef double FLOAT64; // COMPLIANT: exception, typedefs are permitted -typedef long double FLOAT128; // COMPLIANT: exception, typedefs are permitted +typedef float float32_t; // COMPLIANT: exception, typedefs are permitted +typedef double float64_t; // COMPLIANT: exception, typedefs are permitted +typedef long double float128_t; // COMPLIANT: exception, typedefs are permitted typedef int8_t astronomical_number_t; // COMPLIANT: aliasing a fixed-width numeric typedef typedef uint8_t u_astronomical_number_t; // COMPLIANT: aliasing a fixed-width // numeric typedef typedef int - astronomical_number_t; // NON_COMPLIANT: aliasing a basic numeric type + _astronomical_number_t; // NON_COMPLIANT: aliasing a basic numeric type int // COMPLIANT: exception, main's return type can be plain int main(int argc, // COMPLIANT: exception, argc's type can be plain int char *argv[]) { // COMPLIANT: char is not a basic numeric type char c1 = 1; // COMPLIANT: char is not a basic numeric type - signed char c2 = 1; // NON_COMPLIANT: use typedef int8_t in stdint - unsigned char c3 = 1; // NON_COMPLIANT: use typedef uint8_t in stdint - INT8 c4 = 1; // COMPLIANT: typedef used instead + signed char c2 = 1; // NON_COMPLIANT: use typedef int8_t + unsigned char c3 = 1; // NON_COMPLIANT: use typedef uint8_t + int8_t c4 = 1; // COMPLIANT: typedef used instead short s1 = 1; // NON_COMPLIANT: short is a basic numeric type - signed short s2 = 1; // NON_COMPLIANT: use typedef int16_t in stdint - unsigned short s3 = 1; // NON_COMPLIANT: use typedef uint16_t in stdint - INT16 s4 = 1; // COMPLIANT: typedef used instead + signed short s2 = 1; // NON_COMPLIANT: use typedef int16_t + unsigned short s3 = 1; // NON_COMPLIANT: use typedef uint16_t + int16_t s4 = 1; // COMPLIANT: typedef used instead int i1 = 1; // NON_COMPLIANT: int is a basic numeric type - signed int i2 = 1; // NON_COMPLIANT: use typedef int32_t in stdint - unsigned int i3 = 1; // NON_COMPLIANT: use typedef uint32_t in stdint - INT32 s4 = 1; // COMPLIANT: typedef used instead + signed int i2 = 1; // NON_COMPLIANT: use typedef int32_t + unsigned int i3 = 1; // NON_COMPLIANT: use typedef uint32_t + int32_t i4 = 1; // COMPLIANT: typedef used instead long l1 = 1; // NON_COMPLIANT: int is a basic numeric type - signed long l2 = 1; // NON_COMPLIANT: use typedef int64_t in stdint - unsigned long l3 = 1; // NON_COMPLIANT: use typedef uint64_t in stdint - INT64 s4 = 1; // COMPLIANT: typedef used instead + signed long l2 = 1; // NON_COMPLIANT: use typedef int64_t + unsigned long l3 = 1; // NON_COMPLIANT: use typedef uint64_t + int64_t l4 = 1; // COMPLIANT: typedef used instead - long long l1 = 1; // NON_COMPLIANT: int is a basic numeric type - signed long long l2 = 1; // NON_COMPLIANT: use typedef int128_t in stdint - unsigned long long l3 = 1; // NON_COMPLIANT: use typedef uint128_t in stdint - INT128 s4 = 1; // COMPLIANT: typedef used instead + long long ll1 = 1; // NON_COMPLIANT: int is a basic numeric type + signed long long ll2 = 1; // NON_COMPLIANT: use typedef int128_t + unsigned long long ll3 = 1; // NON_COMPLIANT: use typedef uint128_t + int128_t ll4 = 1; // COMPLIANT: typedef used instead - float f1 = 1; // NON_COMPLIANT: float is a basic numeric type, use a typedef - FLOAT32 f2 = 1; // COMPLIANT: typedef used instead + float f1 = 1; // NON_COMPLIANT: float is a basic numeric type, use a typedef + float32_t f2 = 1; // COMPLIANT: typedef used instead - double d1 = 1; // NON_COMPLIANT: int is a basic numeric type - FLOAT64 d2 = 1; // COMPLIANT: typedef used instead + double d1 = 1; // NON_COMPLIANT: int is a basic numeric type + float64_t d2 = 1; // COMPLIANT: typedef used instead long double ld1 = 1; // NON_COMPLIANT: int is a basic numeric type - FLOAT128 ld2 = 1; // COMPLIANT: typedef used instead + float128_t ld2 = 1; // COMPLIANT: typedef used instead } \ No newline at end of file From b1d08d3b2fd2cbf5c8b9cc5f2b969006bf03540f Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Wed, 1 Mar 2023 16:28:34 -0800 Subject: [PATCH 18/53] Initialize INT34-C --- .../INT34-C/DoNotShiftAnExpressionByANegat.md | 16 -- .../INT34-C/DoNotShiftAnExpressionByANegat.ql | 19 -- ...ftedbyNegativeOrGreaterPrecisionOperand.md | 204 +++++++++++++++++- .../src/rules/INT34-C/LogicalShiftRight.JPG | Bin 0 -> 16405 bytes c/cert/src/rules/INT34-C/ShiftLeft.JPG | Bin 0 -> 17066 bytes c/cert/src/rules/INT34-C/ShiftRight.JPG | Bin 0 -> 16095 bytes 6 files changed, 202 insertions(+), 37 deletions(-) delete mode 100644 c/cert/src/rules/INT34-C/DoNotShiftAnExpressionByANegat.md delete mode 100644 c/cert/src/rules/INT34-C/DoNotShiftAnExpressionByANegat.ql create mode 100644 c/cert/src/rules/INT34-C/LogicalShiftRight.JPG create mode 100644 c/cert/src/rules/INT34-C/ShiftLeft.JPG create mode 100644 c/cert/src/rules/INT34-C/ShiftRight.JPG diff --git a/c/cert/src/rules/INT34-C/DoNotShiftAnExpressionByANegat.md b/c/cert/src/rules/INT34-C/DoNotShiftAnExpressionByANegat.md deleted file mode 100644 index 66c3d5a7a0..0000000000 --- a/c/cert/src/rules/INT34-C/DoNotShiftAnExpressionByANegat.md +++ /dev/null @@ -1,16 +0,0 @@ -# INT34-C: Do not shift an expression by a negative number of bits or by greater than or equal to the number of - -This query implements the CERT-C rule INT34-C: - -> Do not shift an expression by a negative number of bits or by greater than or equal to the number of bits that exist in the operand -## CERT - -** REPLACE THIS BY RUNNING THE SCRIPT `scripts/help/cert-help-extraction.py` ** - -## Implementation notes - -None - -## References - -* CERT-C: [INT34-C: Do not shift an expression by a negative number of bits or by greater than or equal to the number of bits that exist in the operand](https://wiki.sei.cmu.edu/confluence/display/c) diff --git a/c/cert/src/rules/INT34-C/DoNotShiftAnExpressionByANegat.ql b/c/cert/src/rules/INT34-C/DoNotShiftAnExpressionByANegat.ql deleted file mode 100644 index ac5def1e01..0000000000 --- a/c/cert/src/rules/INT34-C/DoNotShiftAnExpressionByANegat.ql +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @id c/cert/do-not-shift-an-expression-by-a-negat - * @name INT34-C: Do not shift an expression by a negative number of bits or by greater than or equal to the number of - * @description Do not shift an expression by a negative number of bits or by greater than or equal - * to the number of bits that exist in the operand.. - * @kind problem - * @precision very-high - * @problem.severity error - * @tags external/cert/id/int34-c - * external/cert/obligation/rule - */ - -import cpp -import codingstandards.c.cert - -from -where - not isExcluded(x, TypesPackage::doNotShiftAnExpressionByANegatQuery()) and -select diff --git a/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.md b/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.md index 601dea39c0..0c9a635019 100644 --- a/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.md +++ b/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.md @@ -3,9 +3,209 @@ This query implements the CERT-C rule INT34-C: > Do not shift an expression by a negative number of bits or by greater than or equal to the number of bits that exist in the operand -## CERT -** REPLACE THIS BY RUNNING THE SCRIPT `scripts/help/cert-help-extraction.py` ** + +## Description + +Bitwise shifts include left-shift operations of the form *shift-expression* `<<` *additive-expression* and right-shift operations of the form *shift-expression* `>>` *additive-expression*. The standard integer promotions are first performed on the operands, each of which has an integer type. The type of the result is that of the promoted left operand. If the value of the right operand is negative or is greater than or equal to the width of the promoted left operand, the behavior is [undefined](https://wiki.sei.cmu.edu/confluence/display/c/BB.+Definitions#BB.Definitions-undefinedbehavior). (See [undefined behavior 51](https://wiki.sei.cmu.edu/confluence/display/c/CC.+Undefined+Behavior#CC.UndefinedBehavior-ub_51).) + +Do not shift an expression by a negative number of bits or by a number greater than or equal to the *precision* of the promoted left operand. The precision of an integer type is the number of bits it uses to represent values, excluding any sign and padding bits. For unsigned integer types, the width and the precision are the same; whereas for signed integer types, the width is one greater than the precision. This rule uses precision instead of width because, in almost every case, an attempt to shift by a number of bits greater than or equal to the precision of the operand indicates a bug (logic error). A logic error is different from overflow, in which there is simply a representational deficiency. In general, shifts should be performed only on unsigned operands. (See [INT13-C. Use bitwise operators only on unsigned operands](https://wiki.sei.cmu.edu/confluence/display/c/INT13-C.+Use+bitwise+operators+only+on+unsigned+operands).) + +## Noncompliant Code Example (Left Shift, Unsigned Type) + +The result of `E1 << E2` is `E1` left-shifted `E2` bit positions; vacated bits are filled with zeros. The following diagram illustrates the left-shift operation. + +![](ShiftLeft.JPG) + +According to the C Standard, if `E1` has an unsigned type, the value of the result is `E1` \* `2``E2`, reduced modulo 1 more than the maximum value representable in the result type. + +This noncompliant code example fails to ensure that the right operand is less than the precision of the promoted left operand: + +```cpp +void func(unsigned int ui_a, unsigned int ui_b) { + unsigned int uresult = ui_a << ui_b; + /* ... */ +} +``` + +## Compliant Solution (Left Shift, Unsigned Type) + +This compliant solution eliminates the possibility of shifting by greater than or equal to the number of bits that exist in the precision of the left operand: + +```cpp +#include +#include +#include + +extern size_t popcount(uintmax_t); +#define PRECISION(x) popcount(x) + +void func(unsigned int ui_a, unsigned int ui_b) { + unsigned int uresult = 0; + if (ui_b >= PRECISION(UINT_MAX)) { + /* Handle error */ + } else { + uresult = ui_a << ui_b; + } + /* ... */ +} +``` +The `PRECISION()` macro and `popcount()` function provide the correct precision for any integer type. (See [INT35-C. Use correct integer precisions](https://wiki.sei.cmu.edu/confluence/display/c/INT35-C.+Use+correct+integer+precisions).) + +Modulo behavior resulting from left-shifting an unsigned integer type is permitted by exception INT30-EX3 to [INT30-C. Ensure that unsigned integer operations do not wrap](https://wiki.sei.cmu.edu/confluence/display/c/INT30-C.+Ensure+that+unsigned+integer+operations+do+not+wrap). + +## Noncompliant Code Example (Left Shift, Signed Type) + +The result of `E1 << E2` is `E1` left-shifted `E2` bit positions; vacated bits are filled with zeros. If `E1` has a signed type and nonnegative value, and `E1` \* `2``E2` is representable in the result type, then that is the resulting value; otherwise, the behavior is undefined. + +This noncompliant code example fails to ensure that left and right operands have nonnegative values and that the right operand is less than the precision of the promoted left operand. This example does check for signed integer overflow in compliance with [INT32-C. Ensure that operations on signed integers do not result in overflow](https://wiki.sei.cmu.edu/confluence/display/c/INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow). + +```cpp +#include +#include +#include + +void func(signed long si_a, signed long si_b) { + signed long result; + if (si_a > (LONG_MAX >> si_b)) { + /* Handle error */ + } else { + result = si_a << si_b; + } + /* ... */ +} +``` +Shift operators and other bitwise operators should be used only with unsigned integer operands in accordance with [INT13-C. Use bitwise operators only on unsigned operands](https://wiki.sei.cmu.edu/confluence/display/c/INT13-C.+Use+bitwise+operators+only+on+unsigned+operands). + +## Compliant Solution (Left Shift, Signed Type) + +In addition to the check for overflow, this compliant solution ensures that both the left and right operands have nonnegative values and that the right operand is less than the precision of the promoted left operand: + +```cpp +#include +#include +#include + +extern size_t popcount(uintmax_t); +#define PRECISION(x) popcount(x) + +void func(signed long si_a, signed long si_b) { + signed long result; + if ((si_a < 0) || (si_b < 0) || + (si_b >= PRECISION(ULONG_MAX)) || + (si_a > (LONG_MAX >> si_b))) { + /* Handle error */ + } else { + result = si_a << si_b; + } + /* ... */ +} + +``` +Noncompliant Code Example (Right Shift) + +The result of `E1 >> E2` is `E1` right-shifted `E2` bit positions. If `E1` has an unsigned type or if `E1` has a signed type and a nonnegative value, the value of the result is the integral part of the quotient of `E1` / `2``E2`. If `E1` has a signed type and a negative value, the resulting value is [implementation-defined](https://wiki.sei.cmu.edu/confluence/display/c/BB.+Definitions#BB.Definitions-implementation-definedbehavior) and can be either an arithmetic (signed) shift + +![](ShiftRight.JPG) + +or a logical (unsigned) shift + +![](LogicalShiftRight.JPG) + +This noncompliant code example fails to test whether the right operand is greater than or equal to the precision of the promoted left operand, allowing undefined behavior: + +```cpp +void func(unsigned int ui_a, unsigned int ui_b) { + unsigned int uresult = ui_a >> ui_b; + /* ... */ +} +``` +When working with signed operands, making assumptions about whether a right shift is implemented as an arithmetic (signed) shift or a logical (unsigned) shift can also lead to [vulnerabilities](https://wiki.sei.cmu.edu/confluence/display/c/BB.+Definitions#BB.Definitions-vulnerability). (See [INT13-C. Use bitwise operators only on unsigned operands](https://wiki.sei.cmu.edu/confluence/display/c/INT13-C.+Use+bitwise+operators+only+on+unsigned+operands).) + +## Compliant Solution (Right Shift) + +This compliant solution eliminates the possibility of shifting by greater than or equal to the number of bits that exist in the precision of the left operand: + +```cpp +#include +#include +#include + +extern size_t popcount(uintmax_t); +#define PRECISION(x) popcount(x) + +void func(unsigned int ui_a, unsigned int ui_b) { + unsigned int uresult = 0; + if (ui_b >= PRECISION(UINT_MAX)) { + /* Handle error */ + } else { + uresult = ui_a >> ui_b; + } + /* ... */ +} +``` +**Implementation Details** + +GCC has no options to handle shifts by negative amounts or by amounts outside the width of the type predictably or to trap on them; they are always treated as undefined. Processors may reduce the shift amount modulo the width of the type. For example, 32-bit right shifts are implemented using the following instruction on x86-32: + +```cpp +sarl %cl, %eax + +``` +The `sarl` instruction takes a bit mask of the least significant 5 bits from `%cl` to produce a value in the range \[0, 31\] and then shift `%eax` that many bits: + +```cpp +// 64-bit right shifts on IA-32 platforms become +shrdl %edx, %eax +sarl %cl, %edx + +``` +where `%eax` stores the least significant bits in the doubleword to be shifted, and `%edx` stores the most significant bits. + +## Risk Assessment + +Although shifting a negative number of bits or shifting a number of bits greater than or equal to the width of the promoted left operand is undefined behavior in C, the risk is generally low because processors frequently reduce the shift amount modulo the width of the type. + +
Rule Severity Likelihood Remediation Cost Priority Level
INT34-C Low Unlikely Medium P2 L3
+ + +## Automated Detection + +
Tool Version Checker Description
Astrée 22.04 precision-shift-width precision-shift-width-constant Fully checked
Axivion Bauhaus Suite 7.2.0 CertC-INT34 Can detect shifts by a negative or an excessive number of bits and right shifts on negative values.
CodeSonar 7.2p0 LANG.ARITH.BIGSHIFT LANG.ARITH.NEGSHIFT Shift amount exceeds bit width Negative shift amount
Compass/ROSE Can detect violations of this rule. Unsigned operands are detected when checking for INT13-C. Use bitwise operators only on unsigned operands
Coverity 2017.07 BAD_SHIFT Implemented
Cppcheck 1.66 shiftNegative, shiftTooManyBits Context sensitive analysis Warns whenever Cppcheck sees a negative shift for a POD expression (The warning for shifting too many bits is written only if Cppcheck has sufficient type information and you use --platform to specify the sizes of the standard types.)
ECLAIR 1.2 CC2.INT34 Partially implemented
Helix QAC 2022.4 C0499, C2790, C++2790, C++3003 DF2791, DF2792, DF2793
Klocwork 2022.4 MISRA.SHIFT.RANGE.2012
LDRA tool suite 9.7.1 51 S, 403 S, 479 S Partially implemented
Parasoft C/C++test 2022.2 CERT_C-INT34-a Avoid incorrect shift operations
Polyspace Bug Finder R2022b CERT C: Rule INT34-C Checks for: Shift of a negative valuehift of a negative value, shift operation overflowhift operation overflow. Rule partially covered.
PRQA QA-C 9.7 0499, 2790 \[C\], 2791 \[D\], 2792 \[A\], 2793 \[S\] Partially implemented
PRQA QA-C++ 4.4 2791, 2792, 2793, 3003, 3321, 3322
PVS-Studio 7.23 V610
RuleChecker 22.04 precision-shift-width-constant Partially checked
TrustInSoft Analyzer 1.38 shift Exhaustively verified (see one compliant and one non-compliant example ).
+ + +## Related Vulnerabilities + +Search for [vulnerabilities](https://wiki.sei.cmu.edu/confluence/display/c/BB.+Definitions#BB.Definitions-vulnerability) resulting from the violation of this rule on the [CERT website](https://www.kb.cert.org/vulnotes/bymetric?searchview&query=FIELD+KEYWORDS+contains+INT34-C). + +## Related Guidelines + +[Key here](https://wiki.sei.cmu.edu/confluence/display/c/How+this+Coding+Standard+is+Organized#HowthisCodingStandardisOrganized-RelatedGuidelines) (explains table format and definitions) + +
Taxonomy Taxonomy item Relationship
CERT C INT13-C. Use bitwise operators only on unsigned operands Prior to 2018-01-12: CERT: Unspecified Relationship
CERT C INT35-C. Use correct integer precisions Prior to 2018-01-12: CERT: Unspecified Relationship
CERT C INT32-C. Ensure that operations on signed integers do not result in overflow Prior to 2018-01-12: CERT: Unspecified Relationship
ISO/IEC TR 24772:2013 Arithmetic Wrap-Around Error \[FIF\] Prior to 2018-01-12: CERT: Unspecified Relationship
CWE 2.11 CWE-682 2017-07-07: CERT: Rule subset of CWE
CWE 2.11 CWE-758 2017-07-07: CERT: Rule subset of CWE
+ + +## CERT-CWE Mapping Notes + +[Key here](https://wiki.sei.cmu.edu/confluence/pages/viewpage.action?pageId=87152408#HowthisCodingStandardisOrganized-CERT-CWEMappingNotes) for mapping notes + +**CWE-758 and INT34-C** + +Independent( INT34-C, INT36-C, MEM30-C, MSC37-C, FLP32-C, EXP33-C, EXP30-C, ERR34-C, ARR32-C) + +CWE-758 = Union( INT34-C, list) where list = + +* Undefined behavior that results from anything other than incorrect bit shifting +**CWE-682 and INT34-C** + +Independent( INT34-C, FLP32-C, INT33-C) CWE-682 = Union( INT34-C, list) where list = + +* Incorrect calculations that do not involve out-of-range bit shifts + +## Bibliography + +
\[ C99 Rationale 2003 \] 6.5.7, "Bitwise Shift Operators"
\[ Dowd 2006 \] Chapter 6, "C Language Issues"
\[ Seacord 2013b \] Chapter 5, "Integer Security"
\[ Viega 2005 \] Section 5.2.7, "Integer Overflow"
+ ## Implementation notes diff --git a/c/cert/src/rules/INT34-C/LogicalShiftRight.JPG b/c/cert/src/rules/INT34-C/LogicalShiftRight.JPG new file mode 100644 index 0000000000000000000000000000000000000000..5f98215baf3800fe1922fea72dc8725e9b89929a GIT binary patch literal 16405 zcmdse2{@E{|MzVVX_BpkX|a_pAt}x1lq8k3SYwWCA$cSrV{U07ilU4-nMz2~lqHd7 zvJ9srYbGPx*q4~GjGNj1x6c3nzSsMh^FB|V=Xu`idZ+82YpS{D{(bk)_xJt$_+R)v zz{&&rtoH#z!T=xy{{i?Nz#c$YXz{i9F1+{>6ew?sI1tk^@h8} z$EGvW>sItWY@G#85XnbuL;`N>OR`8f6VlE$vO4jZLbh2#nu~&ui9-V;T|NnVe6%3^1s}E__9KB zqtQ`@!l`pjQi|%vy&B9#(Y{Oe&j}X&QM?B1 z?U&g5BvKC}grj!Rc*yK(!wgoG*NUcyOASzz2NL zihQ8rFdsOL2K?Mmh1@Kh@NixZG(=HTjxgmCLh^3woKBnNC7i`JKsFw=X=ltQ4J1BH zmy@^J8hk{>@Byg~o)n%BSS2$g_<(GlD<2sA6otCN1u!513fteDbxn6J`@?kKFARxC)2@% z=U5{dIqRXA{h@SB@~9EQ4rp9a~)-1&;Wu~g~!wxk{|GaKNXcg?sWkxj`D%w zDICBD=qCPTPJ7c&tlll0Z3dO_q(a%dA(5lZS;99RhLWW#x)!C)XlW;pv-3}0ciBrN z&IAV!f|V|6<}L0+;bAC;`vdby;W&4Iz3MMpG-Rk-sT>1q)*P~9%Jqg;jS*=+J$f91 z9492WH#Ja+71{Ps*@N=HU-|daDL&Avm)s!gD{f$52-dz!{)lqA`3_b27R*d181YtpVGgDvcGgu) zl}{RcOs<dFg!e-hZ4I^xz1+&uhd1t>uwE>;oLJ zCI?$)L!7xWE0B#EbJ$?tWHQE8`8rQvq|_!Fe+ln$L);w-$9ZO8QY}!`{~}uk!=bnm z48%l}Re6XobYEbN!4=#V2DO^3>K5kBs;vYiO%93ks%v}S`Zy-^>U%R~W~}DYEMjX; z_1oNDxA7Jt_w=JUKwH42Gt}Lo#XG!_b%YNT@PS-#^eyv#q!*u*^_cZCMzx_NLaCl*7gunFZ%&peO1=g|j zIAd<_t>1tZL2*C@Hv_dTESQx9N%jzEN);EBZ)PO+O-lNb);EpM#?oz`*am+%!TXffaK+pvdo<-Xb`_)Z4t_^KYp9`B zuz&WRfZ!FU%&irwk5=hgrS`|||0I>Ra5f5sg>Ul*-%<2>$Izt~Rz#UQ@YZ_thH~_5p*>))Diguk$Ojm=;3zTT1JXOk8^KBw z*mF(q_k+K3b3RSuS_a{?8{Xyc1=q<3R`G!%IK_jH9Eu%=x`yDy45yFfYcIjK2J@81 zcydI@q6EwVD-Gd)@!+j$_{In3hq(8+_y*c^KbOeU;Q4gG1;l@5RTL_cTLAXc(Ow9) z!2+I_*S&_?cw&0;TQVQel4Way?O-c;)(!eZihi&{q|cxRl;SLB%X)4zGnRJ;0ds7^r>C%(-?%9-JmX&0!o}j({nt%E|_gB}PJWw)N9|o}&jX0D) zoN_TEIoJ2%owU$6bG_$#Z~LK;t(p6?QYxpk`_He6?Z4*OpJ2TqW6i_TS1JC!k5X)n zxFvVOj@2NAc{{_R12n$vVN+n`$! zoOOqyqfnQL>o2oPq0mUS{cg50r8jZ46}_c*?WC;D6W6eP3sft%#$(#?qqTuxu!^1E zsv-MV^wy6XrUv9zKc4DKrsfS`;>e1mHNI$uLqjyUJOp!HS%Vm7f{X%JUd@Tg`ur$i zp|AckR!i4KFFyQrlAh7gB=ZnOrM*7y@c{CKLj(DhE$26@aX8s}@d3Cvevatdu^>fS zV&O)K#uM+bUQk0X=2C`Qj7!`2>@Jt1pG~x9CZ!>lJ=Zl_vAc8kC)Fuj{q5-fSTDm` zILy>A)Nr#wj6JbRD?clje2P+C180$wa^GboMZ$!^bumR+h%Nb*;=<2y*+SfCq+$> zx?z7Y5;1D`_-LJbxcs>tl6%kX(LHCSe%p3=yOjcpyM_F3C3cRLd7|VPgDHXe^K~xPA=z%rvNzV1UfVw5zP00!d;wR<0*L}E zOvwFRSSwghY6%f`CsNmfD^Z*cpgR*g^j0hHWS%YhG?hSmeMT11Br zWCffac55@(LnMguR*#Zb8QWmw{m=k!y|gXDCeKoJwl@7KblCBgi{f;Uy0dqddf2G0 zer!XsKI-WM1OYrlnBSh*zK2)GgCXD3xtfp}1uUBlXRG(sxDQAcX4Zh~Kr$jecp{Pr zWipL^foysL_RuA+>z3~h%^4xCd>vDTQ)o4LGk+!73OVttXgI4h{howj4fe(IE8)MU z<*?1MXBb1@G#GLf=puvYag(*XkhNW_TCjUE+s9<9@pjH`9acf|=VBix85-Q(kR+NQ z)Sw>h(xuM~y^59Ybv;&#GGgizGEZOBxPmVu<>z)=1qQeW$a`CBrdS)Q*zF^fZnb9Tw;M%UGppTN%1tPqX<^%FYOODn0%P zen)YMVz#>yUOSbdg;&XVi`mRM0Tnaqtl_jy!pcD&PdWRW^sshMI3my$J@Z}q`SPJu zwX=D>W~bWExYSqQ_D#EUyYI=1vW=*NuYrZ9OM^~uT8%N@jY-?5zr*QYLvI^AwK3LO_hoH|!MYk- zd7;@83e$6(UGY3gUp`>1yNKgsl7Ha?{ZG-o;~0jG?Si!rjN{GIl=y(g5s5})hlXwj z%K*~I;i?zH4U5_#X+Dtj1itGfSfPg=(I5aIW9l@9bJs#fUbzng8I0XwglvVE^f>S4eND%>OZUkJaa))cY<whZb)-37Pk{u zzk_rg_D~^cQ@GaytUviJ^=tr6*LRhb`-z*y@JlK|$ayQRZ?s$_`o1FzR zyy=HlW{Kqrv~wa9p~P9$!b@^mY+ezXSK%yq9Dr9Q0D_UExl!nztZv3(v?x}JIzv`~ z8)pkREJBZB{h{PY1yUx{!z$WZZ=yW#d8f;vS2hn*vrAIUJn)ZS)~Q^MmWdz;45P)? z7jCTt=@cm-kc7~J68swW39!Nj>`Cuh4}D`Bk1l9&S-D^Q}936qK&L2A(BI_!hj+#jZ=6uvKtwuN^#;3+))LF-bp5E;qDNAmzw=Jfoeo z1M8d@By8HwC$1d1<$uv++~Gp#-)eVdeJ+pQKaj9HwSUj={lON>$Kj=8+u5NbWrRv* zFQFr+f_A3B53@}3O)|y)RnUC0A8tjN;Z5%j;^cBWN?JJZ zp2}S}BNRICe>H6I4GCPAWae?p+ic~Onabz9bVmcdj1LRyaA>rvpF_;voz59I3=UzS z-I#&nB6P{Db_UIn$WuAAWpJ#bq`8i@%;FQ+=#?;ZaD?~t6YUtUEDDtj*FfR7_0N=2 z8oVM`!HIu7$xLG5!+Z;Cb!i!dB!-o+gqWhu<4}Mu>{Tl?Q-ec#I!3(MqU(In!&_^E zv(LlLrcb~oKH!S6rq&ZmaOt@m1GP2WGOTKLon{sz+P~ENguf5+-nN{cvCP$N0cAV} zMa6#MH@k#F-ylmqpm$niWQUIFKhUJ}alqlHe%*g$2Qk=RY@o0mvln*v2=#>Byn?9B zBNsp2rmJq13EcNKZsOC#>Y<{tl3Uhr-7`{&4OdC z{==#UPR-_fvUleXQ(wBacUGye@b*)Z8&k~0J#Hg5-mV9H?JVVm{yh$F|2*K=@>dZ$ z!%2<+_o2PF1zl|Si@DcV1GYyOlQdU%c;S!9^6}c_ZNw3Ih(@X zqL&!X_B8i;>gB*J{P@aCzwvN z`9PiDf*Z*l{`%F^J4z}ctR5Q+Ngv11b)C`zCs>@^OXnJm-u*e zX&M2tdcT2tnP+eN(rpobe{&n5vR-yNxw=@BbW$I$?YoP>&MM?#^m*^_N=TsGq0a!) zvL^>?;TdhGi!oPQ4x;Fwffj^i7#wmyC%*L_y!noUJ;)>fm^b_caY5#*srbr z!-`$ds-p3((>ph`RA;EQ_PlK&e)A|RD0`KRbuip-TDw_oepFk;9(HI%Iyz9*^cduh zfYH&}hGo8Zxo*z7lnIQYQ~N&8^ka;W?i7=B*Qmig-+j@l752r|e8AbiyL=aMI76>l z&)mBA+hOU>9lW-kc{+K%rj%g$%h+=dCo>*B|4OR}Kf`ipQh!;e_I~3n@EP$Q_^VBP zVw9T>6VH*$!;~i1LH@?h#LAIuBy+YW9?s#*H+{1Dq5+qKTFz9_D?HETh(zmRy>cim zj-F~CCqATav53^eo zc{@MZ@A4u!MGp`;Po5DG{tH_1=i_Zxg+&~To;yq~P8j_#N;||nNmp8BOJn^d40PVGg-@Qu3NtY`$UXO+xgRqyRZfpSgu1jS_CoDf>)X?soDk^z_q* zT~lLfFha_H<9h=R3_HswmftfDIMqzL{*Tic@EOK8B0uMd|BS}|?QysDXL4iS&k6h^ zk@r)fP0V?^)NlSD)QF!B$T# z0GB`zzd&FUglCDqehrDy$!oxh9mVW>=HzRImQOkQX)p*wx-BE6U|v-I)*l(|IC1_X z*q~$M3l0=VT4La2SMf`cs!J~xrN|{=#j(MEi9=-v=xg(Vfh-_$m*w9uFzh>xzC>0o-<=29_G;B25n*_{M!jb_RJ|e@Hy!-T zxM6FJT>J<0o9Uxw%RX&a=xP-D=|@KHIx+G0i2aC|!9P)bp*ofqG{(qe370S@$Aj4W zuqT>0TD|0}ctgK#nb~eRf5VQd;GT|ob+*job05G6jhodD&W`b1pS%8k;ahKT(=EgV z01bN>C*gk_xj3|*m_~5qb#{LyDOL3bb_~69K0fDMQW0O5PEc@aw<5WER8aRBQv(ct z`~6g$cJZ>zQSWAYBG1|31;>c{fG5uJV~P`d(N_qovAgK5Ru-=c2q#}PnuI-ftI>I= zo|28x=1tb`@87t+=ZHiE4ErTMq8Uf>CF~&#;wm|iAmn?j)300HK>sZEgpZfnd`O~% z>*^NQqMG3KaoUesHzek!+r**geKC8X2uzc?%VX!T4N@XG3XQB2E_RWEDgPX*m zfj!;3Ea6S2CGblX_mQlMlgGWY=k4Mqpiei%m7%Y2Oc@1(dM>@BH}nASondFOYe98_ zdr^Xu?WE_+*KuPuvf#6+`~X``yIY9D#mc@EgZxYez}PwbobVP%Tf37=RcIQbC$NUN z(vK$xSu*_~wdcSBd+$(yW3Ez5m9Q~syMP8_@$xR;!x{lD>fkb}=E9}WVcveBU99XfRCsf08<5)8_r40$U3@oZ1Q+1 zZQ{5Prvzha#p47BYSg;0p#$Vt!*;JI-+>n^vPBtoNrxsZFg3Ec&8&bL} z7TbP>X^m&1@P5u0PQ~xUE_fRPrZozf)4YJKY7g@T@za_0a1o8~S^L;-@(z*0l^<8* z10yG9#01Q}ABYJu=@pnu6J#~cW>~SJp^x1q2IFI}ea}M}CgxDd>jWE^Ftbon^G$ga z-j8ouV`RYEi}9NpC>}oa6k)8EaRChF>MpwYQlkr=l|_ocO(!1+f}i2M=tH#k{fFSs z8zG6c^ASv~8X0(&nv_=w%k}_SjO54#vpTpb97{GT49%0qFlu}4v+^ylM0p6^cQ{7A z?pE;f2c05%Mfa*-TB+~bU7Kn~gnxP|xoB8~Va1cV!}J-4y;rmXif3D6HMv<}pg|Pt zC1w=2I#4DorK(RYQS;t&7fbF_^D$rC=gT*l_cp#uLT^KFIj1vQB5+#r-|`?h3W2a| z?J#eIEwi5_RA#9*e}IE&I$SZyyK60Q2$U>f&U!>*8rFt{Jg$K(3Z6E&QO`cd`$T3q z*k0uW3NsxMvHfHSlZQRq^qk1qC7TRyX?R+)i25#WS7;BWcaIGD%z z2#i^n9;iX!suLF{)~?^xKfGDcEGx=V9l=F0w~^@a2UBsE}R1!)Z& zD0xf_Z)F2?wgGZ1o8+h?87*W+KG>_kqo(s@${O zMrpcT8rlcy8UXue)O61i~|;)$H7jan$I=|oAyHR zO!+#7Da{A)tzcC#*(Y&9n}8%Ub$IK+sRfwa^=MIjG5)v)#CZ9_X+^6#335jj@rWX;izLI zQDVcW4Xs6ocGA16bFqf>`^Waai3m6#vlY3*zwG17cGtbwIw!B>1J`Iau}s|~od*LR zmz2t$teOlN#2|6vi8r11#XJp*prF5~88F=5a>+fma`ir}-)HI%I=g-WA3M+Aj(_7D z5EvNX6^}i)`fQe=O~ASJWw9c+xi`z*=?&0+k{(BzT5g%^e=)Su_PSk|My`BG_OpPU~93c+lv@dqqWXp|UETR#!}Ea&C8WrYO#$tD5(rnu=*yD`>#ntJ)Gaa9^v|`}weA1IWIDH`d|M!QJ0O`x z6OIT*rwgqen>tM3g`YDgrfV26wsSlon6B-Vd_83A5*TaKucprX{7vM^*PhIqr7g;)+!{J0g4ew7d7FFd2V z2D4+X`ojYtBCEWcaT6|$aAZp(c`GLiLGOtvQp*5Xy-3Gq@&VRlXL$Ewc?*fG$C!gv zE65xzBqI^5Yz%~s6BsYRUO2s94dh-y!CY-gD;Am6kj~8?3MaG^XauG)TkGynBykS( zXG?Gnj16A|=9iieX1VbwKXLz1LOkF zG&4l9TBd)9ANHMj<{(9DmCC7u+ox?I&A{s%o4#&HOKF_j2P#AOBW<%cJ$eXNiL(J1 z`_iO{baw9f2q&*JCofHFucUpx%VX3DR4Ufd+$W^>?SZ-q<(m6B{^uO))bQX_-vYM| z+R0R=d~-*wu7U9{yOUR@7_AeP^iWrx<^x~ydJN(~FRfcqJ&A);1ew934;My5}l$*Bw3gK;alBBxuI_#5oyDt7{jCxW}L7BaY&}J~Y zs3S3vWYB7EKyQf7Feb&kGdDb9HpJ`CA&kqc0Ar z@2YiZs&88oll3ggE4BlO2oTWc5Fg|T?C>MS7Ki_WT{L8>y8!vFllX$Y>MJRCZg_e}p>lut zEXq>iD?EG@bdKv;2=^ZP3{jQi19>qGSXa3@xHbOH=qki&*RVM1FARqYf3ET%YtU61 z-qJ1AKU;1YsS*@h?5puEUY)Y~chN?P7UTbBWGM(Bf{~($a@;($&tx2VEfKdCBKDL} z?u%4(X+Qye?O40)P6%Jo;(x)^%{%_-@RW;9fDHFaIVI0V`_`fA+rYjR+9Dm=M1d!K znttM#nZQGGfr1Fag>&ILt7Z5n|Al>#RNfoMc65b< z@74*-9L{Ol}W)u`uL`tGK zpoI{bq(n@RQ3MJZBnnDMBJ-30h6_n<`cT!cU#~XRT~>Af>#bfDxB*s@%Q<`a_C9-m zTl!ww4K3ZdZO1l9ZVm*=fiFnf32lMq$jv@xpXbaz=Avew=gpmqnkzp~UjDaBL2QG-T8Vyn&UDw>fOzv2)-40|#AP-Q0bS_#XB14+snm3qKhV8FlLXg^QPBV&mddQmWoZ z{34u!r)OsOB?qB?-xhe5xi2NKuQ{_iP?+79+?)t-p_Jy%TWKz@Z0D?SI7CHv?b-RN zKU}?=|4LDB-Cn+$_lf2O>iQO(Rf5^A{kF3|x3P17X=ndqWB<9Y4rmcd4k!<$1mPix zI4j-=`gdIPTTGJY>b{yTOGze9sgZ|Q575FVA{L(l5Iv#-+`9MeaeA&d-!C4^yU-O- zqIAeXqvKfagNp46qnAz?54cZH3G1X#YOLfMewaB(oS~EbY!#)@l6FZZzCVjhkwR5; z_@Wf5AH;Jy*oCzcRYEcwzAlB9GN+@7b}WqG2NAc1)}1i2rMv0Eq-jLeY`c zX*=>uCBxo!rfmn)QnrZht>kv>x~_x_W7a@Xe&S6Y!bmBU6(VW|olz;IE9u58=GU8c5UY3~PJLBWA(3Gs zg$64H^P&}OF*s^vG1D)3#)yVt3XGAJ)bW{Q_+-hjKnmHb@TQPe)G91OblD_@7Sjd$ zL=K2XpHSz#6k2c^QI|sE)nmi>{6;CHh!xVs`cjCWNIfRW{#AtiKz)V}6{3wBMCci6 zhj%*jlt<&SQi4apz2Aoa)tDfIJHP57i5M4tY$ z7U5|)vPw``C50BUUNO-O&CY?A$a*d{q3I&o@KMl}I)mE}JHs(TrXB zZCpk{lAC_Y{0GHt!}m`I?7Gz9V}T2A3vq~8qhKX-vE!J(X$zxT(-Vkdt`stu;NnGC zwmS98Vffq`^w&yumbrkLC1vV79_ts$z2y~xI#&07v#+F>!Wb|9>NWVgrAdv3}` z!+2xQwZg5>Vrz~cU0T`aUTc!}a)_@*OG(3ztXwuXw0vrNk*f+UuGcqw9r^` znW01Wh4DF&0D-F6$<~)8+11GyfAd|mB6iZ9@!_y0jUX-GL|@%@A53XcQAuJQQm{Ak zNXBP_onOXeDt>M|K+`AzMv^v`fS-9PwjIdKkB9|(~Uw8yNI;OHgG+kdQbo$If1DYt}P-Y=-}RZr{e>dE9`pS4`iCPThwd5 zv42v74-W_+ElZUgd0xn&Q@Sqd$GVJTn)e|9 zLo!12#H=$GHeF=;(mVWwVQmy;@iw?v3aR;3za;#?njBLThY7rxhpC69(0sqRG4bQz zaL?VnAEnU!_Z@Ha$HnE|ntBF|N;>VUFc2m;six{|JMWJ!8Q?*`lheoUG(>jm3HL~$ z0x9&EI`~p>8;YLis$v_OEpZ^07Pe-W7B^2m&Q0k>w%>cxx%GI@rIjYx zO6N`TtI#ubddt=`?V(6Rv5H?gTNS5DDaXh&l*LEjkVmjbb><@2H!Cv2^X+=$PVIE% z!HQpvzh9;7+Gs&oeu>?X7`N6t1;56@0On1V8r?zD@ZGoA<0PCOSdv8GCxs4TVvYN) zWnnwx{2g?X6yn^ZfT(?xTB#$2DwLW0cxr`M3S9&$SQskW**T2&l|mQTh_VzKCOw^| z1tP7Yh#7?$WU6bm zxw_uBx~uP3hhnea%(^w`>V0EygMC}q2YX0uqEA+`L&Q;Et!IAjB0ESSUlF$nd4gZM zN8xSw1ik9A3b&XgR!!rOl8dlsaVweplf&>`@E@hnUMckMG|w8ESx`n0 z7QjRvNu4NO55MBK+999XaZ2zELG2aiz%NN1gr)Xo2|xEwso$7VzN%_9$JE{9X4yx3 zllJ^ACeQL4j^7o&F+zcKfch+0tW=n=ly*}wE) zGASS=M9JLgNADKz=V@;moSni=%pJp*>kg8RWyM3XO^E&n1_w>ExZC0c?nB4|M}A3d zhekPVDI2!h2JhgGXdDuhX(gqtxIv5lIZ$iyyQ007rjro`-kTQ?*VK}}lOJR~nn=Xk zJKIBl-tD62*=l~f+kK|;ooFcX9@tp~k+on)K`N)_9*3kJxsG!qj`JzPwvB%5_z}mP zg&UsSzqZ52qS@wzHg)Y<{kr(=;#bQvc*$M;cjhq2Qs`U|wXO_KM(U@kX%bh;cOYTt zYl00*#2HPoz;T#lH=xrP?gD6L2_qc7nngZX3ORy^Ul|DrNx6bJaqH^J#s`G@&P{{f+>iRq)8m5 z(1EeUq5jn}tjiW-=WMSE{n6#}EA<(OBn-1AaDX_=R>!H3l>{19a{MW-q^mfuUq`FW zqCTkgF!n;3{ew7f>)cNdiY^=)JXk5e=cKa37UDK%TMV9Bd4$qTos45AGht^jP73ut zOoopocVLmLn*>wf5P*+ii`!UlE%qohvH2e`MMQ~i1aAycrJ|YBkMAMcdcp(%(!0gc z0D_V^;1lcDPcBxK6X1t41VO@Q@M3<+UOpbYr~3w5+n|&Q-{ujP)*8^b$xxkA@jJ2e zF-3svj%$coYwQR8wf}u|ABigcPNDEC{Y$dW1 zFBV{Gv1%P3KXyctb_Z}01mU$f(;IH@IWS;U?j=EZ_zs+`Tz8_r* zU3x9al0pM2ObnHO4+h(8bRr?uY!um!Rm_a0=mEvXXY{6xSl@nuOw{Y_b^J9%dxkEybQsZ)Lfdb{;B0ykQ#pnN2K8$h zp?c5>c)l|&4kIThdBI$!mf+@CnRBT23Jk#zx$Ql%expKw zZ_8);Lw{7?m<*%229REz8ALk6UKox=!AwLkSWpm@18~2~La^vW0Aj>nbXD7vSgn6-edH_$;vsme+eX zFLJ#}TGg}Wz|6Tyu8rYJH@dKEVA`9BUBs8>iZ-u#DSF?{aV;Fh6lK?d(=Gx|wJ5TK zpuYNKiIruhcI&Okq9IEl-?q`X@!TigUv6;&bT6%xLYsXF?tN76v9k;#cm*HV(ZqG? zxjmL_e zcrzcLdjp@PQ0o(~quJk$n3Nv6CYLXJ6?hq*+iZ(bLH?FGL=$CN>g3`mDKzrEfLTc` zq?WUl#3uxvxs8q4mnM5NO|2W5E$cUBk#mAHUmpGC*7m!x)F!um?PqN86|`B0(OCm0 zaH$u&w174Fipg#3o8%v)z&AQf_m!VBUY3`&wzIkyqcZIkkTCUdrD6K=6I+i!j_RkR z(ASCur>kL4zEw2_#Zc&U6YnT1d@1OQU++Ov7H@A0Rv67I?riP-2qMbBHR6ln802=Y zx7zT2IRT-Tn!qfkR}lOf+a6ju;Oh{3=cOlHg7<86A6CI z2%xk+?qrVH8^(irbmO@`cIO8mEojq{j@5sl;lv^=X5P*ZP)>1YPoYG0}Nq9jY zq0afpOxMq^RCTUai0hfP1y`RWqgN?A^r1z!hL~R|(G|hR;RCUqG4`-kpiR>}@e<1} zV*!0xlBin4JimEzoI22sUAOPb$s3+#J7{wP27kxMFfcK$Pj46mhIp8z%#=b5u3vwAJ9ahU{(b#-sx zi6t%d59+)M{|zz`uAW^xI39NF<54ex!wg7e7^A&rNxgN zKOSsjm2DviXb(oNKK`WA)SJvAxzAnSgIV}ktz2IId@)n*#KJ5F{K=s6c*N=sQJLdFSj4t?lM8EwbRoGgxYQThf^ zgN)#}7Q?s2lj}qHe@|RSd(ZYi=y=HkoE1zGl7JuMle~lQc&0&6Ec9UX}jgfin zy}hlKr$Pzpw~w+1v~D-!4iqPP6&`ZZ-&2L}d-8b5R>$d^6ckkZ&G`)78~DPkKm3{N zAD{WhXa4b-rT^V$(BF(Tn?xGq#R7-&v9rQPLz{-a&o#v z7eC{xF**WDrrANR7ejQuDdPN|H2hah2>wZE{?F&`e-fJi%mx2RX#PoP{@*1u#&yg9 zX2(Iy2S$Cx9(&L=@Y>j37R6159mtzFP4c%bH@!&6e@GnMyJF@xD6)ps20i?=eOD^# zCuoU3sy#3>`()|S4BTUr(@3LgiqAl*mzwOt$>Tf<3tx0F`@UyD2=&$X44k4_@R6i- zhOr37N8bmzL^}md6NCpqv7!_K1uVWBvxCIRKFe4ZDInwTMJk~aiivaKH?B{@O@pe+ z>($c(7Ew-`af>kljI=jvldXmolFi&D8|c-^upU9IY{^0tuLos|ePB?NoBI&{AkgNm ziQV3{D#L}Z@IGuA+O_EY1A&7x4W79YmA!m^VGnD-N=6ORAJwmA+(V6F^PLIt81+dv zu@k=!QA`tz9caxB|3ujF%L`AB^0&ucwvu|EGGe9}hP!U&jpXTKkvxL2`E>r(l>;)W zy|y}_urm)7EzZ?a8mRo8q@}Qw3JUn_Hm z)!VfrO+Ch{}%u)d%smzTNyw`Zhbju-7rfmpu zQqp@<0%~@)6U!~1*0y;w7Jz^GoKlI`rgrDCbtnshXlnTGOd6&L9Rqrs-Yh)F_-RWx z8?t=-#4${$wS`a_&SB>ZIVaDT7EV4NVuQ6N2 z*z7u(xt{g8S&a1$Po7gJxp!La@;h-p3KJ*Lm|1oGGvmm^4N@pPFQLV^EXmv823=*VxTEjHa>5nz zTiQ)6zb8Al`60ObIsvtFOs2!+Lv_P` zZk}JW-ICMk{!^ zgw|n|@A`>YztkM2DN(cByc~OX`Xo=e)?MW#*`go+{13kUgKz)f+y7mB>!D}^nB0mp zAiKZy6F5|YjuwXvuTDpF9KRR(kZmt&QaNXnlM@tM*h0XXr(!JR zzIdulOvwt=G7Hd9H0lpwHfD?D7xF=zailSaSWSDM!0oGi2A`!L@-LNt!3FVS!6Da| zlkUF4N8YI-V^Ek*%<#1AkF&X_kGiAI7P_*eE zuJr4slP$)!nJBBlefO;tI*w6Gj_+Cky9oS*y6|)U2;;jTmX_JsJQy@oD$>-k(dy~Z zKWpAc-ms33`WUdBN_7cFwKvOOe>6h%pPD_M%4pdCZ|ERT$)4P?1+Yd%X?7CXkL!uw z_IA=y5gQ)uv5%3|)lt!5)R5w2lH$D~>oPv_h#`df$-5+{kJNe4?lIY4a#OsL+!*p8 zPzvchK;F09mv;!=q$gqxqBu{d^Pm%`8r$;{ZN-`QH ztlP=h23~G>`1Eufm2;WNA&p`9H>j1MIsCd=3YjklDg&Lf3qJS&DdZuAzQe$&;Zi6W z4I;Hr@{V#A5FKUFbY>PXq9p~?&s@AOT7;cRLvq;5Sa0`32hkVEo*d$eNEb&z(|H@m z>>+ENlEW)TujT}#HGlLVb~cBj(D6YwAC$ZPa@ z>STQYAbq$1R;Cka+KQ$mg+5SbyLdV1Dz(WKvI%||I~GWi7y58w#HMuEnaM9KBEU|} zr}z?(c%YH@2_k~XxJiWVMCx8NimWn3^i4X%^ji19p@|8=46D?pR-a1?0rk?CZ84%Pm0bocx@{(AiTfN(yuyphtBsOe zd8u=Cd^CH@au7ve5=MoRTcF2%2DSnuhiBIS>r$pYg2@Y6=Bp|^&u z1r)Pz(^jD4P7z8(ML__HsMj5*>idj05-!uJFcwQb8Z;ln4mxxUz zJVdz(Cb6fr@V$C8_z<3-=r@8NqJBn!X^rDd0S5sPqQfq|gMMo*8=>o|d}n$*aS2Y5 zyj60GvRdpZczBz`UhGd?9=<8p&!gS!f_nSYr~Y(%do%%i?) z!#uUB!E~lo5({c8a(6Ez%wbdgG0J3r0aC1f{=T~;vnC)*UGV9uKI2$^?a~yVB{u9Y zC&K9kOwKTo??{;0;a83k+uQ;yo>hRDXyF1#RYEMhDqEso*o{VXoEA!<~0OY`?>}#59wYIZKwb|N<6doL^;$T|bu+KsD=|_A06O|^;^{Q9vH1+6NXEvfQ(iW91 zg|J*l0-t{I3GUV109MDR z(JbM!yRq>~q0ttFnmo*lq;)Hmw(2FV0pFWuKppcBc&V~jtY>iN>3>rk-$uxE`F3&S zU5bagaS&*>M~K#mSH8tT;uS5$ruYhm`csko#cX0wL}@}t$0c1O`^L$Z2A@RA=!S+1 z_DhpCl!NcFen92|s7BI+7r-=@3)hhf;I$%{<0(I8|8|rssL3Jus$FkY zG`kyZt$o+mDnmbHQ~Kd6v;y~^dOK7w+0Ea`-d#SGU}NsfBQ6@$Sd&8Mhs*r2d9 zV`uyEFwrC4^|{BqpBJTkAKU|_tcu^>lbBdz*ZY+6*X8lewB0f`vMi!IMvTS6{%qK; zNxUl4FGENh(WX6>z6UF-T-MgUt|9Ke^lolLh24k$;C< zAQ4bDeLb{A`%@Gtn+HQ0Rbv-eQ!8Ey(w2){n$={%&<6B;>MK<#^e@6iS_$SNv-=Ka z4x)mVgZnBkQ-$^D`Hn(Q!~GfuQ{7+t7GPe)32^+w;{~C;ipIlQ|5KA)b{Z`^cL6Nr zzrEeBr>*{YV8UK?kDOP4U_$5%JBl0wvjVaZZN5>AII=^R~j;-~XoX~5E^We$wUoaqE4!aq68_%>{hLIVYq+0VHkZy1YP zeOqi+anYAMe4lh&?-_p9K^@u56Zv-y4i0)`q{r9hhU%BB+hI|lPA4CK`ODk&>WpTyQ9vkSW9rOk zCxVYYTjzlpp?`c6JbL`_T8DE!w_Ino+aCjw{C^$V{Oy(i3BDdhl{xm-KRZ$K^^mA* z*I$;(WDl4W>60~_`3Lhvf2iG>zbu&OjemGk8Ji{A{bMq-!Q=k}lPT#Yz=mVP1Aq_J zr32^tJ|gdEFK$xoYCO$(CdjTOs7J=L2`_H_I#}bD!rK4NELhAg_;jeUH|oe)lbgCP zx&Kjv`u(SIU+@-0kuEY{;pf7#X!PLr#+I^T!xsmNcJt{Yi+P>~RcyAWV|0YY$&=Pq z2l>+_F3NAVI@j3LDWY!87sm0gg`;x_%jP&CBQW+U(8QG<>vVUF(c{y2xJVI7h zZn>QNvc(ttuNBLetyuie;!Xbk)g?=%rI#*4$Rhsy$WOhAUjqtqz(XmFw3G(0L_tbg zK}y^Rpx|{b{d0NnV*mb$eR%GL1lrKRCTFNIeOe>w*KJ0PR5RB^M3 zt*nykafC*=vgyTZcjPpGEvs8|sDq=m&G*bD`DH4qYuBl1>*(s~|6*po-C~EOmECUp zJq~*v_Z|N2$Wb?U4^Kb;fD?g1!6zfmMxKkpMW2t0zkDSjF)2AC^ZJdf?3+2cg?H~2 z-7kLd@X@pKipr|$=PzpN8yaa%&2L)Xc6N35^!9!1A7HZBpT7)`jD8*CPS1Rw<;_9! z3yb@b0;K=GE%;sHz7*hnEm=GR#NxiBmPEmqw1Uji%_g#nwyucd;Yu2&7v+?Hy>_Rp zPF{1{Ae`wsS9uWzGT9%#CEn7J7|kafPBC&ck`(YZ}92?!O&4 zrWH#V4b+H5-zcQu#Xv#`p&j+z6^#K|Zh~LMz?WGRXA-`lC|S38O0Z81Bw_`W0%XA` znS@~u(94^J$}U7YbVCfRrq0JW2&}z$I5AL|#N~?tMJh{G3>ZI<9>S#ryU?;PIwS0A zjzJ&w$H(nL*>+&jU_&J}khq{nLQ%N}qRrs+0uee_J;4Bo~Lql9-rKWqYN zCB;}E#fiEsGR9x1>=Iny`pnsKk0E%sx!qS5-Wtn6#KY;EwQ^gwk}89H&&-#t{j7m9 zByI7~EI>a0S!_rWhN~D@)ho=$j27YvVxW->T^0kaW5B|yWat9VK$u3^h!21;B{&#j zG&<2LO;}7LqJm8JlPc)x1=AB}+f_r<0#XAsdi_u}6&2N~Euv?K^8NEZ>+GAI`cd?M zqC=8A?us@%;oE>6yCI<%NWyZLi-GKJsqY)sa7HGV^VI}4P$(B~rvnSrU8O222(>xy$|Jbx=(UaQwJURZLVJi9HidGqRd|M@d58!jOJp|bp(K;~y8 zEVAb_rVKj~%9&vs*9pB~xUZ&c5kz-~O`;8PeA{Gy;eA0QBHQmi?xlN|p`X4=`C4I5 zQBmy)m)VT#Gg|b`rUwy!n7RFwNM=SPZK$MOw3*P3RuN`VgGv2eu8&ES(oflpfCI~j?>r$tSDtjWW^CCo}bQSn|U_aPRo%Mm<$D%KlVpx~wXla-_)q#XMlKiOW zRMKI;;9Qp^8@nx;ev$l-jhDP0JTcZvnA>AVtH}99Q}_}6`-FisZGgs0U_Np1?x;mQ z7@s?O{_Nb*8uShGXUFI*%F$jyX@5Lz)V|Kz8j!W)q8RYd^3#dkVf-|OXx(LQ)(+ibks8GE@5M=b?;?SXAt34nio<@gN-iQ`O? z#vg=S`2b!G7EC6y=`J%&1-FfvmBjoMwX2(a>a@R8$?_eK?_GEFGwZN9qYj#yYPBTq z71XWIV-tr)rD3S(R15Oj6UD#;74IPidJ1zd z7cvwICX)s*94hANcNBD(&Z!myOgHejFg*-%1S>(Nt{8~-;|ETnqxuQ0!ZJSTX|zw^ zN3cuOHv%@6Qi{mw@E2|pti`|yuwkPZs8^(NlEHd`7`XgI3@ne}?;D)J1i&|;ixlBS zg*}}oofLKPqZSYg)Mqi7Ld+yK7}ljDF-f~nXi-0AIvn*ZL6|Lc5(7u3QpZPsnV;je zh=I&R;dRUebqu>e#s^|;4L2emC%msr_t?V3oS>)W>p}$-Qz(XOML$4n!mhCK zu`yt^+1Xv$`+f4j*NWB+2MosbzGOIVO7`+T@YbQ~`kT=E+w4ZX9h9RY4hbJqRG~py zwisAR*ors%09Hp5;|b_Y+TU6}@V_XTS1w%F(Q0V+#c*^T!8U zjUGp+KXB={V1jA2x**qpjc9y@;4gQFUa&_6ZkWrSEbAN_jI!sJ8+Qi>jvd>*|M0Q3 z6*o%*rpuKNdpoT-^vOZ4=BD(Z!A~4F?4-x*PNS^_giZ{jK+R&JjSQ*QZ^a?KpQS^tMc=nl^R!>bonLY$%hFjN2WYEEtF2zW7XDGaCv3~QZJ}|>`LkFn!QKwEfj3y^ zNKk?Jzd}kZbul12N|(3sE*#Idh;!{^KkJ&RbhfjtsY-SaprrHmJKS*^UOV|2_~bde zF+5&+^pV6Pb!(?qxd?7KOxzIzFkTM9*uB8E0v49l#_=+seinFnoIy{ZuL%AA)h2+8 zp^em2l)BB|_-7vI+LFDW(*1?Vo`3d zUO-l_Wm@+pRq$WL%XuM=G?B-lHVr9Jp&Q&dmQS4U@?-ol?stL#ss2g$hIjd>WFysm z9g~w=wrJ?+m#*;K?`Ashk*r@@bVdL4-FR>3$?Hg-L)R1EuTtJ z11}j@BID3XA1djJ_nW%RNQ$^C-a1X=b7e^~)vlgCj>vDR2`Ry*zd7)q;_F&OjhMBy zNBDaPO;~v_2vm3f`XMBLClq`KN;z8HS&(6{_jK4}jh7jEyJ2-sbllRBqqRd?YqoUm z=Z$-(tCtCm11BCvbKb^QM)+3ckX-nrO`hkA)HQi2V&L8ZK@9A6h|D=LU~ZnkrVe(&2}J`5F^*CY z1j15&0r8LD9rd(-f45|4`%A{U-P@lw`ez)vhAU{%QQY=ghJO&zRpAEv7zBoK52J|Q zDKPm!*(&%2c9|yx7kcqKS;s3)xGT;C zi}W}vuBm%tX=?dTLQqrq0|{*^)n!_>er<}szro;Qu#)y|CiQ*gn&~SrE|#i6B&KoF z5DGGZ{coKq+S+4Wq}OFURcjd>UW!xBgCr+$dfpRKj&*kkj!PSk%v<{*~1YVM*COoBRA~xDK&Vts%yjXFq8< zgo=SR7H!4@k=9Ydkt~~g*|%60vsma9allw~&6*3J-7-u9UC{jj@d1uAGerGh#WB|k zD(CAIu@>xZ`MX5FpjU!*d(hhWlTcuxzy&%EKe7dyc@*T?mi#Gr?ye_C>%`tX$Ui+y zS>89(Qqe(Ak+w-=ms|m|q(q{tj1p{jm{b)5dv8PVkzGbLOo>j0yv6v_Q?QlQufs0a zWM34(rz=wh^_%y=dB>C*?uwx8U}#C44BvLXHCRc1#6L_jI0BV$ z+?vrS_*uvBr>+b#s~cO%tH;Ye;qJb+{!*D;zwj+Xvq}sk=M861THSsrnrYp5$mxB! zdTh)Sdpw-xNP_k$Y87@;RXNmHV0D2#g_D{g3m1O@f2t>DrH?F6DgJ>~|R$Q`>9G z_af;(-d9FKqQZ4)22-e&WEwV^x)dM56a$cUbJLqpiaLIO4R_Vc4SmTr(iATbym9GQ z4eK!IAtjj5^>C0nWmEP=t9C?z`UtjhKL9KieGx9(Wb;~ug{-t9xP0S+k70}MyDVx} zpFRghp9vgnx;5-nWq}PyNXMo5_TgW9PaPe1d8O8OQPXrcy+JDi2Omhzn+(fcS^83n zfISf7Eh)S>Ol3a91W^}uPc_p8dLk4!bJ)j~uOsjjKA}kCjk;@*uoZ^1tD9O%$s%1` zSEETwF?9E}>F&@-Q2FHf%E#aGGtCGY(CPfWta8;9Rg2~VU zry!$yoGfZlv!Z>`cy*NNo70ij;f=?TTR$H}^nQ1>2bAG!%@=CboFIotBlC5v=0thJ zIu zRb|3&B&`=LgK>}3r~G$b?#t;l@fqZ7W2;`m1fk+7YET=8^)324Ryl~bke{c;oj;Qp z;4*utne@qN-CIXhLHX6ydu$6<^}@L`Qdw9S$n?iayQR=bEAu^S zAAIgH+8sOKXe=mCUKsGolXnqJ*Jiy$UBs-jS;w~%pg8oVcA%F2QKZ{>yxVYdZG7|2 zD(<^&dm_HHDGgitz4yy7Meh4nGVBt!3OwO5h-{>nr*(&-;zYl|{)vcIzlHpz?>EI} zSjS|u^7H*WX^$M50z&wr4<8U+XBWjhqg$7NDc7A$V1@NJjcq5^!Op`|3^bEgzDL{$ zc_i-#r;~9`E-t3QzCD_3(@NM%1%-UA;kpclFh>4+?tQrJ)iDAbMtd*T<6P2fB_8?N{-7nhsc~unALdHB^2bb5$IuY z0~-Rf!hW$dcXHjdJp;~S4Ox_`tl|2@V!(#1O%5rH-GTj|mtTi;+7h(6YV_RF#vw$$A8yUWZ?h33|hg^srhZF6fAFltBIl7;qK!V+h+G@ZsXFvLy_4UT2*o+tlIG`gjSgV2 zlgmpl4ZLdLofiWc(hQKVY}PK+POfG1APB`K!d}gnTV1zT#U%+`8F>?r<-BvUxV|OQ z+I3T=OEf}5ecWTqDQz)u-z{|4My~ze!1B2!l8mSWt|j12xb4ig?q{Pu2A!L`D>`g+ zEbllX79RSwOb@5R_C*Y2ooTZD>iq>+!y;An)wQb$+#p+2A{tqT6c`eLlU!Umv%J;f z#`@f%2Upb{;iqJUW4)Xrj_Zqoe7B6g%8p&@jbD>e^H&J(h>%biJ22KKYywpJx^+xt z_0X?=`GdIOb$2bNhm&U3myMXTtV0w<9r=rz^yjh6XEGW{{h7Q5Sgh&m-&Xd>l)>qXZBcP?j#=5sYup@9kr=2j|NaSAJXy(!XritWt#)7`<2ZJ3IZgAm zTCI;EbZWZoi-XR?lUlN!j^LMDZoQp zS-0gJUAAry$H%F?5EUyH;$G<4VHycL3JF^GIV$c6# z@!y3-DHxCcef?;)W`CKc4_*-MZ)WugGdEli1I{xC5qA8YV2cz7BTQBc6lKu7)57U+ zR&^C6Ee1Z`xetCdJo51a;;k3}u8Q7btBO;o{z9j@jjN#tVWLd}!#7K;VL!dy7}|UG z!8}{2<377X2v%%)X^;KQElxy7NejZ^6!)>uc1V9o3)h%gT8>N+txGyFeffRyNiD_T zsZF2lVnVdr;;G-?PL|XPNfa|kmq&!QF^TEms?$Z;zjA%9ttz^o#58GJwinamw9zHo zEYPGCB`D8=BPC#J(RBZ%;N_=XZs{1sAKE&?^A|o9IP-UW+S37HSS46!hWX<4^pi+i zLy&VdIQZ+Zv!Ulb{E4Gf>f}lw#$xeAu%`I65qwj^M}m&<*6F)J0u=WMSrEt*D&}KNDzs6YU zW2}PT9(`i^Zsu>5iqgSa)amyI#Bp73{YpJs9F4TWU zfv*Hv518-nY)CJ>zL_&58Afi8T{*b#1^K!q+^rq6NV z$q0#+iG=Nt9c}I$sCd>Wu)#{DgxRKHkP;Gl$VxPGWPBIB_MJE*x*NHDB6Iyvgme6v>)LQqT{8g8l8>(v(lD;QC@qIx_?$k6qH}u=H z`NFM!Eo@;B`H3Dtz9Ev@EWAz)bx|d>EM$MP*~~pi7uZ4`S7pv+i%wxVSHHT>G%xHg z8w+26Gb`_N$&?4=Yz*VEF_S1qcss@4?Sr?2izAn94s(d^M4AZbt#vG+9S_}J9J)S5 zm}A)aJ$a$mD{r0U`z`5GFqh*_=Pp`&YaxBtRpnJAN9@kqxZ*hk8 z0V4+zz7K(R{^NN8 zvM7k0L1pA&Id1g+Y|*l!N4V)O-mxwlJ03EjBUtlb&+MdSDC=eJg7rh0zZKu~*T6ix zy8jZ|3)X|!Wq-}J4~!P9`uV!Vzd^>}!60A}7XMipmx3aB*kUe?5$1r5N1nw*BTPWs zwnohFP>f23`AV!$SJsfh3-aBXs}9Seul%aX*Oz&t`2{|jCyRhsjGzo!sKL~Mqo{sL zYyClcPA1LAvbQ#xMT8vi*35R<+uN;Qrj*^sjvd;taQjnHMR;?_{ZD)MXG-4!R)zG2 zNNPp`#*+F2a3?{(_aYYy7gPBP5Sw>^>n2bvW*0qadR4s6#^RB8hzQVh?qQ(=ZuhFv zWEf7wZR>BQ-hD;51jhi&z`C7?#;K18o&`sD;w}RPY3nxUJQ3*Mbx^tcz@98XqXyij z3DaZaC=OhpYIVGq;d1)MB=(1@CfSceOsO?slb3xZSaJfB&I$wVdM7krb()8oE?B38 z@Pqvn9n20n-29TfTgbS&e)XPhxkClW8*rtz&K|9Y_v#4bS~QR#9c=R}w*!@Zkvnx* zlaXQ4w$J9Ask!wFs3GXKsqf3G=ZVyX7dDTZhnsdMNb_!Rm(nK_I2R5>^89^ZoeJ6v zDrvB4l%71QmPKVqe{p=Toovr_$x$xjW!dbtzObMxsRy8}$_67#-yreWsbXZ7wI>aD{MO za&LlXO;*AA4$^o&a?iOdFNK`Hk{5BI`0E*ZGcPYM#N+qm;h;iHZH8X{*pQ`mlct5q z65H#6=VQ?xTo-||F^d>GOJ9L=q0u?}sl=mJ#c7fAX5jLH4Suhmfk8twzevzoCHqOyc$9(eBaY(nclF)xwHDh6#5%@Z0A{wb`iq7zse&M!`T}V3&>MTXIP-5Y+8D z47FbM%!VFVu)YwoJm{{equDdZL{_qyka-nGdw8;qCTnULG+tkWO~umsGa z*v^;U4k;Zw?@SvQ8;3+;sL*f)aP~~J2eBGVB4XgNxe@pp@iz08lX41+WUB8sX^6XeZf@RAB**5f z;uo1tyYTy=!C(dm>C&6Y3OFT}_R!@BrW|>8Dq;Lla8ih{K)b3&leR=3WRDqdapw*b zW=v=oNqr~3V3?=yTj9tCwnWP;L@MW!;39Q355W@y0yv`>Q~-lvf<^Qq$pY-Rh^C&H z0V7BJT4#2Q@7f3#cqO&UhHK$JEL{%WW$cV<*r>#f5-1t7d(t1Wy$Q~!dR~G%$B;B& zQRe;$+q&8WA}N4{9zIUP`}~M=?k(5Y=`If?(j+8XrWtF|aw#}8yyODu<(F8%750l5 z&OR`Wx{6?u^5&ayWKoYmTA0H!&cl4|uxF8Gso!T&Q<#y0>{LQOY@8(ZEQvpM<@(AX z2injYZr|mz)b-G|#u`HTo$+%DLtoXZa$+{nDuoqgNt(I(n(xlgGzgr%tK>A-wS^sA z%)gOTMj=TVZ8TaA^WYOpBa9xrut$*|AqVXw&O8Kxa*x`;yrk5H&%Eo z|ES-LpN8E<{yyl^6t4l=`A{GuEW$8SP-^%i%-gL7Kz~Z|;mpUW&Vo9a?-5RzVWDvDTj9 zl9+vdO?$iswU2@-eRyA+%!|z$7$qvp!ObP&gW4B<%{lyc%__2lS-86PMp!5YzA8~s zAm=UwQxMvm&sPhKh*waYDk^giT+@5sfnjbJy%y2ob_Is-YdndWAj2HCFuu-|#l%q9 zx7vwlLg0pwk^*EF{$B#gfow^-X(qXEAB#}}8BbB1y;`uQB#o8hK}ZS4OffXb8DX!j zO=rz{dShQ>`tvpB%SE@9ec+-g+^BYO70rmw%j25A5+(V>QMJ0CcSiuXT>`iaIB=e{ znY)eE8;40oZv^X1(CD%4+bNrSDxz^L3S_gj}@AAgrq z=vjwk8JM-!-0gF$jQvhH?3W^qDeZ}iWVNsG!cki5R5xyZ>Kt~k>vY&z;TA7Q)D;mL zVyJMeP1#{C!(Qo=SF_gh#uLMv_L`=~;zlG0`Q!#9kI8k1o-oLlK^4%~IEA!okR|&n zyl_-)Dw!M045nx#_T*T98|rT;uV z3y4{IESuII53WF4LQ7z-OH`A~l^SG$?b`_p!UNaWV3lyGQonNTq`9^H<8SvnEAwun$98} zH^b6T)8uM&0dgaZ(F5RHnCNzb%HM=u31`zrMerIBuaOt&s}?z@@m7e}sJNP=Ma3}n zvlsRIhl=sZ({rvDybdj=kYd(#+et5%J|?)|RO@$-H= z#*-Hw)i(GDZ;F(0Bwjqs6L(`dfvaKb5X$tHowEP%jm2#$2@6yIF@<&fd83hX>;Ai;C)-zI**P36t-sg*6ceBI;EPdl!ygwMGQ@1^gpL)5n~e$j%FhGC90 zJW=9X?|nMsBd7Bsixqw1#!yH~NnVbp zl`4Z_MuQED#(WjXG@P-aSHK04KZFUB*b{sdulOUr9cC^D$0P_5e7m=NY(J(0PcIjZ z#qQLQbT3nnWUTd3#e1KCLlvUSAg7+a;}B zXz7=}e|2=KU+#EFJ~!}+VQmQWwq2d)^?}rLxwqqcqYejqw!J4su0KS5_zGQmHfp@p>u&EXUMukY*t3J{cV9 z5*RQ;kWYg=BYD*q9=v+;z*i&w7~R>hX-D%ncIunmu5#>D_;-~k7A=umF4+<eV@H3nWD4wQrnIgEtwUJ&!{$Mo&LILzk zC{8Vvc^70NFr2LD{ICJA;xwUwM=p;c@()j-17XG(r9l)Yyz?c7JV6?zg!PMoNS|vz z$12z6Mlewg$aDfgg}h+`erX)cVp%zshU6tA)H>g@f8g%D_I|p1?RfCTWY_g&%{p>6 zO(t#8Z~_=1at-90!>mmyPM9bs)ZioDgPCHi1_d7E94*>@cfMf0-)=k%7Omk_CVVtAvf_Ka z>h|gFHc|L>OW6G^zx94|;Z6P;dhy{+GT}`C0+dA2ar+P{F}#NP!oNV7OydR@Ik4_` zycE}=p0v_z!?wo!tTP zt$oxJn9Cb=g?DT$`A47(dLxFDhjX)i*>TqTd2RTk!G8OIv-M67um`S;dN>catUoa9 z?yozMRcu)m-z4>QR>GJD<3U%nI;<3X*On3l@ik8P*GDr$s&^@|trEgR+2 zgZ;j4UQ_-LXR#!X9(DgXkO%Vw;d#Ly<)kNR;Ls1}CX&bUe}OEVv-fhc6VVpIS>-3) zvY!pYxmd*g6Txpe`;n)LL78Y;*vs0 z94BPIwNFol_u*rG6bqj}g49y5LD^AY#T4;#w#$p{@MMnef!0qFF!=le{ZBFr+KHV=DfXB^Im*o8Xa3fts=auzjGf Date: Thu, 2 Mar 2023 10:25:41 -0800 Subject: [PATCH 19/53] Prepare test cases for INT34 --- .../DoNotShiftAnExpressionByANegat.expected | 1 - .../DoNotShiftAnExpressionByANegat.qlref | 1 - c/cert/test/rules/INT34-C/test.c | 527 ++++++++++++++++++ 3 files changed, 527 insertions(+), 2 deletions(-) delete mode 100644 c/cert/test/rules/INT34-C/DoNotShiftAnExpressionByANegat.expected delete mode 100644 c/cert/test/rules/INT34-C/DoNotShiftAnExpressionByANegat.qlref create mode 100644 c/cert/test/rules/INT34-C/test.c diff --git a/c/cert/test/rules/INT34-C/DoNotShiftAnExpressionByANegat.expected b/c/cert/test/rules/INT34-C/DoNotShiftAnExpressionByANegat.expected deleted file mode 100644 index 2ec1a0ac6c..0000000000 --- a/c/cert/test/rules/INT34-C/DoNotShiftAnExpressionByANegat.expected +++ /dev/null @@ -1 +0,0 @@ -No expected results have yet been specified \ No newline at end of file diff --git a/c/cert/test/rules/INT34-C/DoNotShiftAnExpressionByANegat.qlref b/c/cert/test/rules/INT34-C/DoNotShiftAnExpressionByANegat.qlref deleted file mode 100644 index 2c0ac34aa2..0000000000 --- a/c/cert/test/rules/INT34-C/DoNotShiftAnExpressionByANegat.qlref +++ /dev/null @@ -1 +0,0 @@ -rules/INT34-C/DoNotShiftAnExpressionByANegat.ql \ No newline at end of file diff --git a/c/cert/test/rules/INT34-C/test.c b/c/cert/test/rules/INT34-C/test.c new file mode 100644 index 0000000000..982d0c15b5 --- /dev/null +++ b/c/cert/test/rules/INT34-C/test.c @@ -0,0 +1,527 @@ +int main() { + unsigned char x0; + signed char x1; + char x2; + unsigned short x3; + signed short x4; + short x5; + unsigned int x6; + signed int x7; + int x8; + unsigned long x9; + signed long x10; + long x11; + unsigned long long x12; + signed long long x13; + long long x14; + + /* left shift */ + + x0 << x0; // NON_COMPLIANT: x0's precision is not strictly greater than x0's + x0 << x1; // COMPLIANT: x0's precision is strictly greater than x1's + x0 << x2; // COMPLIANT: x0's precision is strictly greater than x2's + x0 << x3; // NON_COMPLIANT: x0's precision is not strictly greater than x3's + x0 << x4; // NON_COMPLIANT: x0's precision is not strictly greater than x4's + x0 << x5; // NON_COMPLIANT: x0's precision is not strictly greater than x5's + x0 << x6; // NON_COMPLIANT: x0's precision is not strictly greater than x6's + x0 << x7; // NON_COMPLIANT: x0's precision is not strictly greater than x7's + x0 << x8; // NON_COMPLIANT: x0's precision is not strictly greater than x8's + x0 << x9; // NON_COMPLIANT: x0's precision is not strictly greater than x9's + x0 << x10; // NON_COMPLIANT: x0's precision is not strictly greater than x10's + x0 << x11; // NON_COMPLIANT: x0's precision is not strictly greater than x11's + x0 << x12; // NON_COMPLIANT: x0's precision is not strictly greater than x12's + x0 << x13; // NON_COMPLIANT: x0's precision is not strictly greater than x13's + x0 << x14; // NON_COMPLIANT: x0's precision is not strictly greater than x14's + x1 << x0; // NON_COMPLIANT: x1's precision is not strictly greater than x0's + x1 << x1; // NON_COMPLIANT: x1's precision is not strictly greater than x1's + x1 << x2; // NON_COMPLIANT: x1's precision is not strictly greater than x2's + x1 << x3; // NON_COMPLIANT: x1's precision is not strictly greater than x3's + x1 << x4; // NON_COMPLIANT: x1's precision is not strictly greater than x4's + x1 << x5; // NON_COMPLIANT: x1's precision is not strictly greater than x5's + x1 << x6; // NON_COMPLIANT: x1's precision is not strictly greater than x6's + x1 << x7; // NON_COMPLIANT: x1's precision is not strictly greater than x7's + x1 << x8; // NON_COMPLIANT: x1's precision is not strictly greater than x8's + x1 << x9; // NON_COMPLIANT: x1's precision is not strictly greater than x9's + x1 << x10; // NON_COMPLIANT: x1's precision is not strictly greater than x10's + x1 << x11; // NON_COMPLIANT: x1's precision is not strictly greater than x11's + x1 << x12; // NON_COMPLIANT: x1's precision is not strictly greater than x12's + x1 << x13; // NON_COMPLIANT: x1's precision is not strictly greater than x13's + x1 << x14; // NON_COMPLIANT: x1's precision is not strictly greater than x14's + x2 << x0; // NON_COMPLIANT: x2's precision is not strictly greater than x0's + x2 << x1; // NON_COMPLIANT: x2's precision is not strictly greater than x1's + x2 << x2; // NON_COMPLIANT: x2's precision is not strictly greater than x2's + x2 << x3; // NON_COMPLIANT: x2's precision is not strictly greater than x3's + x2 << x4; // NON_COMPLIANT: x2's precision is not strictly greater than x4's + x2 << x5; // NON_COMPLIANT: x2's precision is not strictly greater than x5's + x2 << x6; // NON_COMPLIANT: x2's precision is not strictly greater than x6's + x2 << x7; // NON_COMPLIANT: x2's precision is not strictly greater than x7's + x2 << x8; // NON_COMPLIANT: x2's precision is not strictly greater than x8's + x2 << x9; // NON_COMPLIANT: x2's precision is not strictly greater than x9's + x2 << x10; // NON_COMPLIANT: x2's precision is not strictly greater than x10's + x2 << x11; // NON_COMPLIANT: x2's precision is not strictly greater than x11's + x2 << x12; // NON_COMPLIANT: x2's precision is not strictly greater than x12's + x2 << x13; // NON_COMPLIANT: x2's precision is not strictly greater than x13's + x2 << x14; // NON_COMPLIANT: x2's precision is not strictly greater than x14's + x3 << x0; // COMPLIANT: x3's precision is strictly greater than x0's + x3 << x1; // COMPLIANT: x3's precision is strictly greater than x1's + x3 << x2; // COMPLIANT: x3's precision is strictly greater than x2's + x3 << x3; // NON_COMPLIANT: x3's precision is not strictly greater than x3's + x3 << x4; // COMPLIANT: x3's precision is strictly greater than x4's + x3 << x5; // COMPLIANT: x3's precision is strictly greater than x5's + x3 << x6; // NON_COMPLIANT: x3's precision is not strictly greater than x6's + x3 << x7; // NON_COMPLIANT: x3's precision is not strictly greater than x7's + x3 << x8; // NON_COMPLIANT: x3's precision is not strictly greater than x8's + x3 << x9; // NON_COMPLIANT: x3's precision is not strictly greater than x9's + x3 << x10; // NON_COMPLIANT: x3's precision is not strictly greater than x10's + x3 << x11; // NON_COMPLIANT: x3's precision is not strictly greater than x11's + x3 << x12; // NON_COMPLIANT: x3's precision is not strictly greater than x12's + x3 << x13; // NON_COMPLIANT: x3's precision is not strictly greater than x13's + x3 << x14; // NON_COMPLIANT: x3's precision is not strictly greater than x14's + x4 << x0; // COMPLIANT: x4's precision is strictly greater than x0's + x4 << x1; // COMPLIANT: x4's precision is strictly greater than x1's + x4 << x2; // COMPLIANT: x4's precision is strictly greater than x2's + x4 << x3; // NON_COMPLIANT: x4's precision is not strictly greater than x3's + x4 << x4; // NON_COMPLIANT: x4's precision is not strictly greater than x4's + x4 << x5; // NON_COMPLIANT: x4's precision is not strictly greater than x5's + x4 << x6; // NON_COMPLIANT: x4's precision is not strictly greater than x6's + x4 << x7; // NON_COMPLIANT: x4's precision is not strictly greater than x7's + x4 << x8; // NON_COMPLIANT: x4's precision is not strictly greater than x8's + x4 << x9; // NON_COMPLIANT: x4's precision is not strictly greater than x9's + x4 << x10; // NON_COMPLIANT: x4's precision is not strictly greater than x10's + x4 << x11; // NON_COMPLIANT: x4's precision is not strictly greater than x11's + x4 << x12; // NON_COMPLIANT: x4's precision is not strictly greater than x12's + x4 << x13; // NON_COMPLIANT: x4's precision is not strictly greater than x13's + x4 << x14; // NON_COMPLIANT: x4's precision is not strictly greater than x14's + x5 << x0; // COMPLIANT: x5's precision is strictly greater than x0's + x5 << x1; // COMPLIANT: x5's precision is strictly greater than x1's + x5 << x2; // COMPLIANT: x5's precision is strictly greater than x2's + x5 << x3; // NON_COMPLIANT: x5's precision is not strictly greater than x3's + x5 << x4; // NON_COMPLIANT: x5's precision is not strictly greater than x4's + x5 << x5; // NON_COMPLIANT: x5's precision is not strictly greater than x5's + x5 << x6; // NON_COMPLIANT: x5's precision is not strictly greater than x6's + x5 << x7; // NON_COMPLIANT: x5's precision is not strictly greater than x7's + x5 << x8; // NON_COMPLIANT: x5's precision is not strictly greater than x8's + x5 << x9; // NON_COMPLIANT: x5's precision is not strictly greater than x9's + x5 << x10; // NON_COMPLIANT: x5's precision is not strictly greater than x10's + x5 << x11; // NON_COMPLIANT: x5's precision is not strictly greater than x11's + x5 << x12; // NON_COMPLIANT: x5's precision is not strictly greater than x12's + x5 << x13; // NON_COMPLIANT: x5's precision is not strictly greater than x13's + x5 << x14; // NON_COMPLIANT: x5's precision is not strictly greater than x14's + x6 << x0; // COMPLIANT: x6's precision is strictly greater than x0's + x6 << x1; // COMPLIANT: x6's precision is strictly greater than x1's + x6 << x2; // COMPLIANT: x6's precision is strictly greater than x2's + x6 << x3; // COMPLIANT: x6's precision is strictly greater than x3's + x6 << x4; // COMPLIANT: x6's precision is strictly greater than x4's + x6 << x5; // COMPLIANT: x6's precision is strictly greater than x5's + x6 << x6; // NON_COMPLIANT: x6's precision is not strictly greater than x6's + x6 << x7; // COMPLIANT: x6's precision is strictly greater than x7's + x6 << x8; // COMPLIANT: x6's precision is strictly greater than x8's + x6 << x9; // NON_COMPLIANT: x6's precision is not strictly greater than x9's + x6 << x10; // COMPLIANT: x6's precision is strictly greater than x10's + x6 << x11; // COMPLIANT: x6's precision is strictly greater than x11's + x6 << x12; // NON_COMPLIANT: x6's precision is not strictly greater than x12's + x6 << x13; // NON_COMPLIANT: x6's precision is not strictly greater than x13's + x6 << x14; // NON_COMPLIANT: x6's precision is not strictly greater than x14's + x7 << x0; // COMPLIANT: x7's precision is strictly greater than x0's + x7 << x1; // COMPLIANT: x7's precision is strictly greater than x1's + x7 << x2; // COMPLIANT: x7's precision is strictly greater than x2's + x7 << x3; // COMPLIANT: x7's precision is strictly greater than x3's + x7 << x4; // COMPLIANT: x7's precision is strictly greater than x4's + x7 << x5; // COMPLIANT: x7's precision is strictly greater than x5's + x7 << x6; // NON_COMPLIANT: x7's precision is not strictly greater than x6's + x7 << x7; // NON_COMPLIANT: x7's precision is not strictly greater than x7's + x7 << x8; // NON_COMPLIANT: x7's precision is not strictly greater than x8's + x7 << x9; // NON_COMPLIANT: x7's precision is not strictly greater than x9's + x7 << x10; // NON_COMPLIANT: x7's precision is not strictly greater than x10's + x7 << x11; // NON_COMPLIANT: x7's precision is not strictly greater than x11's + x7 << x12; // NON_COMPLIANT: x7's precision is not strictly greater than x12's + x7 << x13; // NON_COMPLIANT: x7's precision is not strictly greater than x13's + x7 << x14; // NON_COMPLIANT: x7's precision is not strictly greater than x14's + x8 << x0; // COMPLIANT: x8's precision is strictly greater than x0's + x8 << x1; // COMPLIANT: x8's precision is strictly greater than x1's + x8 << x2; // COMPLIANT: x8's precision is strictly greater than x2's + x8 << x3; // COMPLIANT: x8's precision is strictly greater than x3's + x8 << x4; // COMPLIANT: x8's precision is strictly greater than x4's + x8 << x5; // COMPLIANT: x8's precision is strictly greater than x5's + x8 << x6; // NON_COMPLIANT: x8's precision is not strictly greater than x6's + x8 << x7; // NON_COMPLIANT: x8's precision is not strictly greater than x7's + x8 << x8; // NON_COMPLIANT: x8's precision is not strictly greater than x8's + x8 << x9; // NON_COMPLIANT: x8's precision is not strictly greater than x9's + x8 << x10; // NON_COMPLIANT: x8's precision is not strictly greater than x10's + x8 << x11; // NON_COMPLIANT: x8's precision is not strictly greater than x11's + x8 << x12; // NON_COMPLIANT: x8's precision is not strictly greater than x12's + x8 << x13; // NON_COMPLIANT: x8's precision is not strictly greater than x13's + x8 << x14; // NON_COMPLIANT: x8's precision is not strictly greater than x14's + x9 << x0; // COMPLIANT: x9's precision is strictly greater than x0's + x9 << x1; // COMPLIANT: x9's precision is strictly greater than x1's + x9 << x2; // COMPLIANT: x9's precision is strictly greater than x2's + x9 << x3; // COMPLIANT: x9's precision is strictly greater than x3's + x9 << x4; // COMPLIANT: x9's precision is strictly greater than x4's + x9 << x5; // COMPLIANT: x9's precision is strictly greater than x5's + x9 << x6; // NON_COMPLIANT: x9's precision is not strictly greater than x6's + x9 << x7; // COMPLIANT: x9's precision is strictly greater than x7's + x9 << x8; // COMPLIANT: x9's precision is strictly greater than x8's + x9 << x9; // NON_COMPLIANT: x9's precision is not strictly greater than x9's + x9 << x10; // COMPLIANT: x9's precision is strictly greater than x10's + x9 << x11; // COMPLIANT: x9's precision is strictly greater than x11's + x9 << x12; // NON_COMPLIANT: x9's precision is not strictly greater than x12's + x9 << x13; // NON_COMPLIANT: x9's precision is not strictly greater than x13's + x9 << x14; // NON_COMPLIANT: x9's precision is not strictly greater than x14's + x10 << x0; // COMPLIANT: x10's precision is strictly greater than x0's + x10 << x1; // COMPLIANT: x10's precision is strictly greater than x1's + x10 << x2; // COMPLIANT: x10's precision is strictly greater than x2's + x10 << x3; // COMPLIANT: x10's precision is strictly greater than x3's + x10 << x4; // COMPLIANT: x10's precision is strictly greater than x4's + x10 << x5; // COMPLIANT: x10's precision is strictly greater than x5's + x10 << x6; // NON_COMPLIANT: x10's precision is not strictly greater than x6's + x10 << x7; // NON_COMPLIANT: x10's precision is not strictly greater than x7's + x10 << x8; // NON_COMPLIANT: x10's precision is not strictly greater than x8's + x10 << x9; // NON_COMPLIANT: x10's precision is not strictly greater than x9's + x10 << x10; // NON_COMPLIANT: x10's precision is not strictly greater than + // x10's + x10 << x11; // NON_COMPLIANT: x10's precision is not strictly greater than + // x11's + x10 << x12; // NON_COMPLIANT: x10's precision is not strictly greater than + // x12's + x10 << x13; // NON_COMPLIANT: x10's precision is not strictly greater than + // x13's + x10 << x14; // NON_COMPLIANT: x10's precision is not strictly greater than + // x14's + x11 << x0; // COMPLIANT: x11's precision is strictly greater than x0's + x11 << x1; // COMPLIANT: x11's precision is strictly greater than x1's + x11 << x2; // COMPLIANT: x11's precision is strictly greater than x2's + x11 << x3; // COMPLIANT: x11's precision is strictly greater than x3's + x11 << x4; // COMPLIANT: x11's precision is strictly greater than x4's + x11 << x5; // COMPLIANT: x11's precision is strictly greater than x5's + x11 << x6; // NON_COMPLIANT: x11's precision is not strictly greater than x6's + x11 << x7; // NON_COMPLIANT: x11's precision is not strictly greater than x7's + x11 << x8; // NON_COMPLIANT: x11's precision is not strictly greater than x8's + x11 << x9; // NON_COMPLIANT: x11's precision is not strictly greater than x9's + x11 << x10; // NON_COMPLIANT: x11's precision is not strictly greater than + // x10's + x11 << x11; // NON_COMPLIANT: x11's precision is not strictly greater than + // x11's + x11 << x12; // NON_COMPLIANT: x11's precision is not strictly greater than + // x12's + x11 << x13; // NON_COMPLIANT: x11's precision is not strictly greater than + // x13's + x11 << x14; // NON_COMPLIANT: x11's precision is not strictly greater than + // x14's + x12 << x0; // COMPLIANT: x12's precision is strictly greater than x0's + x12 << x1; // COMPLIANT: x12's precision is strictly greater than x1's + x12 << x2; // COMPLIANT: x12's precision is strictly greater than x2's + x12 << x3; // COMPLIANT: x12's precision is strictly greater than x3's + x12 << x4; // COMPLIANT: x12's precision is strictly greater than x4's + x12 << x5; // COMPLIANT: x12's precision is strictly greater than x5's + x12 << x6; // COMPLIANT: x12's precision is strictly greater than x6's + x12 << x7; // COMPLIANT: x12's precision is strictly greater than x7's + x12 << x8; // COMPLIANT: x12's precision is strictly greater than x8's + x12 << x9; // COMPLIANT: x12's precision is strictly greater than x9's + x12 << x10; // COMPLIANT: x12's precision is strictly greater than x10's + x12 << x11; // COMPLIANT: x12's precision is strictly greater than x11's + x12 << x12; // NON_COMPLIANT: x12's precision is not strictly greater than + // x12's + x12 << x13; // COMPLIANT: x12's precision is strictly greater than x13's + x12 << x14; // COMPLIANT: x12's precision is strictly greater than x14's + x13 << x0; // COMPLIANT: x13's precision is strictly greater than x0's + x13 << x1; // COMPLIANT: x13's precision is strictly greater than x1's + x13 << x2; // COMPLIANT: x13's precision is strictly greater than x2's + x13 << x3; // COMPLIANT: x13's precision is strictly greater than x3's + x13 << x4; // COMPLIANT: x13's precision is strictly greater than x4's + x13 << x5; // COMPLIANT: x13's precision is strictly greater than x5's + x13 << x6; // COMPLIANT: x13's precision is strictly greater than x6's + x13 << x7; // COMPLIANT: x13's precision is strictly greater than x7's + x13 << x8; // COMPLIANT: x13's precision is strictly greater than x8's + x13 << x9; // COMPLIANT: x13's precision is strictly greater than x9's + x13 << x10; // COMPLIANT: x13's precision is strictly greater than x10's + x13 << x11; // COMPLIANT: x13's precision is strictly greater than x11's + x13 << x12; // NON_COMPLIANT: x13's precision is not strictly greater than + // x12's + x13 << x13; // NON_COMPLIANT: x13's precision is not strictly greater than + // x13's + x13 << x14; // NON_COMPLIANT: x13's precision is not strictly greater than + // x14's + x14 << x0; // COMPLIANT: x14's precision is strictly greater than x0's + x14 << x1; // COMPLIANT: x14's precision is strictly greater than x1's + x14 << x2; // COMPLIANT: x14's precision is strictly greater than x2's + x14 << x3; // COMPLIANT: x14's precision is strictly greater than x3's + x14 << x4; // COMPLIANT: x14's precision is strictly greater than x4's + x14 << x5; // COMPLIANT: x14's precision is strictly greater than x5's + x14 << x6; // COMPLIANT: x14's precision is strictly greater than x6's + x14 << x7; // COMPLIANT: x14's precision is strictly greater than x7's + x14 << x8; // COMPLIANT: x14's precision is strictly greater than x8's + x14 << x9; // COMPLIANT: x14's precision is strictly greater than x9's + x14 << x10; // COMPLIANT: x14's precision is strictly greater than x10's + x14 << x11; // COMPLIANT: x14's precision is strictly greater than x11's + x14 << x12; // NON_COMPLIANT: x14's precision is not strictly greater than + // x12's + x14 << x13; // NON_COMPLIANT: x14's precision is not strictly greater than + // x13's + x14 << x14; // NON_COMPLIANT: x14's precision is not strictly greater than + // x14's + + /* right shift */ + + x0 >> x0; // NON_COMPLIANT: x0's precision is not strictly greater than x0's + x0 >> x1; // COMPLIANT: x0's precision is strictly greater than x1's + x0 >> x2; // COMPLIANT: x0's precision is strictly greater than x2's + x0 >> x3; // NON_COMPLIANT: x0's precision is not strictly greater than x3's + x0 >> x4; // NON_COMPLIANT: x0's precision is not strictly greater than x4's + x0 >> x5; // NON_COMPLIANT: x0's precision is not strictly greater than x5's + x0 >> x6; // NON_COMPLIANT: x0's precision is not strictly greater than x6's + x0 >> x7; // NON_COMPLIANT: x0's precision is not strictly greater than x7's + x0 >> x8; // NON_COMPLIANT: x0's precision is not strictly greater than x8's + x0 >> x9; // NON_COMPLIANT: x0's precision is not strictly greater than x9's + x0 >> x10; // NON_COMPLIANT: x0's precision is not strictly greater than x10's + x0 >> x11; // NON_COMPLIANT: x0's precision is not strictly greater than x11's + x0 >> x12; // NON_COMPLIANT: x0's precision is not strictly greater than x12's + x0 >> x13; // NON_COMPLIANT: x0's precision is not strictly greater than x13's + x0 >> x14; // NON_COMPLIANT: x0's precision is not strictly greater than x14's + x1 >> x0; // NON_COMPLIANT: x1's precision is not strictly greater than x0's + x1 >> x1; // NON_COMPLIANT: x1's precision is not strictly greater than x1's + x1 >> x2; // NON_COMPLIANT: x1's precision is not strictly greater than x2's + x1 >> x3; // NON_COMPLIANT: x1's precision is not strictly greater than x3's + x1 >> x4; // NON_COMPLIANT: x1's precision is not strictly greater than x4's + x1 >> x5; // NON_COMPLIANT: x1's precision is not strictly greater than x5's + x1 >> x6; // NON_COMPLIANT: x1's precision is not strictly greater than x6's + x1 >> x7; // NON_COMPLIANT: x1's precision is not strictly greater than x7's + x1 >> x8; // NON_COMPLIANT: x1's precision is not strictly greater than x8's + x1 >> x9; // NON_COMPLIANT: x1's precision is not strictly greater than x9's + x1 >> x10; // NON_COMPLIANT: x1's precision is not strictly greater than x10's + x1 >> x11; // NON_COMPLIANT: x1's precision is not strictly greater than x11's + x1 >> x12; // NON_COMPLIANT: x1's precision is not strictly greater than x12's + x1 >> x13; // NON_COMPLIANT: x1's precision is not strictly greater than x13's + x1 >> x14; // NON_COMPLIANT: x1's precision is not strictly greater than x14's + x2 >> x0; // NON_COMPLIANT: x2's precision is not strictly greater than x0's + x2 >> x1; // NON_COMPLIANT: x2's precision is not strictly greater than x1's + x2 >> x2; // NON_COMPLIANT: x2's precision is not strictly greater than x2's + x2 >> x3; // NON_COMPLIANT: x2's precision is not strictly greater than x3's + x2 >> x4; // NON_COMPLIANT: x2's precision is not strictly greater than x4's + x2 >> x5; // NON_COMPLIANT: x2's precision is not strictly greater than x5's + x2 >> x6; // NON_COMPLIANT: x2's precision is not strictly greater than x6's + x2 >> x7; // NON_COMPLIANT: x2's precision is not strictly greater than x7's + x2 >> x8; // NON_COMPLIANT: x2's precision is not strictly greater than x8's + x2 >> x9; // NON_COMPLIANT: x2's precision is not strictly greater than x9's + x2 >> x10; // NON_COMPLIANT: x2's precision is not strictly greater than x10's + x2 >> x11; // NON_COMPLIANT: x2's precision is not strictly greater than x11's + x2 >> x12; // NON_COMPLIANT: x2's precision is not strictly greater than x12's + x2 >> x13; // NON_COMPLIANT: x2's precision is not strictly greater than x13's + x2 >> x14; // NON_COMPLIANT: x2's precision is not strictly greater than x14's + x3 >> x0; // COMPLIANT: x3's precision is strictly greater than x0's + x3 >> x1; // COMPLIANT: x3's precision is strictly greater than x1's + x3 >> x2; // COMPLIANT: x3's precision is strictly greater than x2's + x3 >> x3; // NON_COMPLIANT: x3's precision is not strictly greater than x3's + x3 >> x4; // COMPLIANT: x3's precision is strictly greater than x4's + x3 >> x5; // COMPLIANT: x3's precision is strictly greater than x5's + x3 >> x6; // NON_COMPLIANT: x3's precision is not strictly greater than x6's + x3 >> x7; // NON_COMPLIANT: x3's precision is not strictly greater than x7's + x3 >> x8; // NON_COMPLIANT: x3's precision is not strictly greater than x8's + x3 >> x9; // NON_COMPLIANT: x3's precision is not strictly greater than x9's + x3 >> x10; // NON_COMPLIANT: x3's precision is not strictly greater than x10's + x3 >> x11; // NON_COMPLIANT: x3's precision is not strictly greater than x11's + x3 >> x12; // NON_COMPLIANT: x3's precision is not strictly greater than x12's + x3 >> x13; // NON_COMPLIANT: x3's precision is not strictly greater than x13's + x3 >> x14; // NON_COMPLIANT: x3's precision is not strictly greater than x14's + x4 >> x0; // COMPLIANT: x4's precision is strictly greater than x0's + x4 >> x1; // COMPLIANT: x4's precision is strictly greater than x1's + x4 >> x2; // COMPLIANT: x4's precision is strictly greater than x2's + x4 >> x3; // NON_COMPLIANT: x4's precision is not strictly greater than x3's + x4 >> x4; // NON_COMPLIANT: x4's precision is not strictly greater than x4's + x4 >> x5; // NON_COMPLIANT: x4's precision is not strictly greater than x5's + x4 >> x6; // NON_COMPLIANT: x4's precision is not strictly greater than x6's + x4 >> x7; // NON_COMPLIANT: x4's precision is not strictly greater than x7's + x4 >> x8; // NON_COMPLIANT: x4's precision is not strictly greater than x8's + x4 >> x9; // NON_COMPLIANT: x4's precision is not strictly greater than x9's + x4 >> x10; // NON_COMPLIANT: x4's precision is not strictly greater than x10's + x4 >> x11; // NON_COMPLIANT: x4's precision is not strictly greater than x11's + x4 >> x12; // NON_COMPLIANT: x4's precision is not strictly greater than x12's + x4 >> x13; // NON_COMPLIANT: x4's precision is not strictly greater than x13's + x4 >> x14; // NON_COMPLIANT: x4's precision is not strictly greater than x14's + x5 >> x0; // COMPLIANT: x5's precision is strictly greater than x0's + x5 >> x1; // COMPLIANT: x5's precision is strictly greater than x1's + x5 >> x2; // COMPLIANT: x5's precision is strictly greater than x2's + x5 >> x3; // NON_COMPLIANT: x5's precision is not strictly greater than x3's + x5 >> x4; // NON_COMPLIANT: x5's precision is not strictly greater than x4's + x5 >> x5; // NON_COMPLIANT: x5's precision is not strictly greater than x5's + x5 >> x6; // NON_COMPLIANT: x5's precision is not strictly greater than x6's + x5 >> x7; // NON_COMPLIANT: x5's precision is not strictly greater than x7's + x5 >> x8; // NON_COMPLIANT: x5's precision is not strictly greater than x8's + x5 >> x9; // NON_COMPLIANT: x5's precision is not strictly greater than x9's + x5 >> x10; // NON_COMPLIANT: x5's precision is not strictly greater than x10's + x5 >> x11; // NON_COMPLIANT: x5's precision is not strictly greater than x11's + x5 >> x12; // NON_COMPLIANT: x5's precision is not strictly greater than x12's + x5 >> x13; // NON_COMPLIANT: x5's precision is not strictly greater than x13's + x5 >> x14; // NON_COMPLIANT: x5's precision is not strictly greater than x14's + x6 >> x0; // COMPLIANT: x6's precision is strictly greater than x0's + x6 >> x1; // COMPLIANT: x6's precision is strictly greater than x1's + x6 >> x2; // COMPLIANT: x6's precision is strictly greater than x2's + x6 >> x3; // COMPLIANT: x6's precision is strictly greater than x3's + x6 >> x4; // COMPLIANT: x6's precision is strictly greater than x4's + x6 >> x5; // COMPLIANT: x6's precision is strictly greater than x5's + x6 >> x6; // NON_COMPLIANT: x6's precision is not strictly greater than x6's + x6 >> x7; // COMPLIANT: x6's precision is strictly greater than x7's + x6 >> x8; // COMPLIANT: x6's precision is strictly greater than x8's + x6 >> x9; // NON_COMPLIANT: x6's precision is not strictly greater than x9's + x6 >> x10; // COMPLIANT: x6's precision is strictly greater than x10's + x6 >> x11; // COMPLIANT: x6's precision is strictly greater than x11's + x6 >> x12; // NON_COMPLIANT: x6's precision is not strictly greater than x12's + x6 >> x13; // NON_COMPLIANT: x6's precision is not strictly greater than x13's + x6 >> x14; // NON_COMPLIANT: x6's precision is not strictly greater than x14's + x7 >> x0; // COMPLIANT: x7's precision is strictly greater than x0's + x7 >> x1; // COMPLIANT: x7's precision is strictly greater than x1's + x7 >> x2; // COMPLIANT: x7's precision is strictly greater than x2's + x7 >> x3; // COMPLIANT: x7's precision is strictly greater than x3's + x7 >> x4; // COMPLIANT: x7's precision is strictly greater than x4's + x7 >> x5; // COMPLIANT: x7's precision is strictly greater than x5's + x7 >> x6; // NON_COMPLIANT: x7's precision is not strictly greater than x6's + x7 >> x7; // NON_COMPLIANT: x7's precision is not strictly greater than x7's + x7 >> x8; // NON_COMPLIANT: x7's precision is not strictly greater than x8's + x7 >> x9; // NON_COMPLIANT: x7's precision is not strictly greater than x9's + x7 >> x10; // NON_COMPLIANT: x7's precision is not strictly greater than x10's + x7 >> x11; // NON_COMPLIANT: x7's precision is not strictly greater than x11's + x7 >> x12; // NON_COMPLIANT: x7's precision is not strictly greater than x12's + x7 >> x13; // NON_COMPLIANT: x7's precision is not strictly greater than x13's + x7 >> x14; // NON_COMPLIANT: x7's precision is not strictly greater than x14's + x8 >> x0; // COMPLIANT: x8's precision is strictly greater than x0's + x8 >> x1; // COMPLIANT: x8's precision is strictly greater than x1's + x8 >> x2; // COMPLIANT: x8's precision is strictly greater than x2's + x8 >> x3; // COMPLIANT: x8's precision is strictly greater than x3's + x8 >> x4; // COMPLIANT: x8's precision is strictly greater than x4's + x8 >> x5; // COMPLIANT: x8's precision is strictly greater than x5's + x8 >> x6; // NON_COMPLIANT: x8's precision is not strictly greater than x6's + x8 >> x7; // NON_COMPLIANT: x8's precision is not strictly greater than x7's + x8 >> x8; // NON_COMPLIANT: x8's precision is not strictly greater than x8's + x8 >> x9; // NON_COMPLIANT: x8's precision is not strictly greater than x9's + x8 >> x10; // NON_COMPLIANT: x8's precision is not strictly greater than x10's + x8 >> x11; // NON_COMPLIANT: x8's precision is not strictly greater than x11's + x8 >> x12; // NON_COMPLIANT: x8's precision is not strictly greater than x12's + x8 >> x13; // NON_COMPLIANT: x8's precision is not strictly greater than x13's + x8 >> x14; // NON_COMPLIANT: x8's precision is not strictly greater than x14's + x9 >> x0; // COMPLIANT: x9's precision is strictly greater than x0's + x9 >> x1; // COMPLIANT: x9's precision is strictly greater than x1's + x9 >> x2; // COMPLIANT: x9's precision is strictly greater than x2's + x9 >> x3; // COMPLIANT: x9's precision is strictly greater than x3's + x9 >> x4; // COMPLIANT: x9's precision is strictly greater than x4's + x9 >> x5; // COMPLIANT: x9's precision is strictly greater than x5's + x9 >> x6; // NON_COMPLIANT: x9's precision is not strictly greater than x6's + x9 >> x7; // COMPLIANT: x9's precision is strictly greater than x7's + x9 >> x8; // COMPLIANT: x9's precision is strictly greater than x8's + x9 >> x9; // NON_COMPLIANT: x9's precision is not strictly greater than x9's + x9 >> x10; // COMPLIANT: x9's precision is strictly greater than x10's + x9 >> x11; // COMPLIANT: x9's precision is strictly greater than x11's + x9 >> x12; // NON_COMPLIANT: x9's precision is not strictly greater than x12's + x9 >> x13; // NON_COMPLIANT: x9's precision is not strictly greater than x13's + x9 >> x14; // NON_COMPLIANT: x9's precision is not strictly greater than x14's + x10 >> x0; // COMPLIANT: x10's precision is strictly greater than x0's + x10 >> x1; // COMPLIANT: x10's precision is strictly greater than x1's + x10 >> x2; // COMPLIANT: x10's precision is strictly greater than x2's + x10 >> x3; // COMPLIANT: x10's precision is strictly greater than x3's + x10 >> x4; // COMPLIANT: x10's precision is strictly greater than x4's + x10 >> x5; // COMPLIANT: x10's precision is strictly greater than x5's + x10 >> x6; // NON_COMPLIANT: x10's precision is not strictly greater than x6's + x10 >> x7; // NON_COMPLIANT: x10's precision is not strictly greater than x7's + x10 >> x8; // NON_COMPLIANT: x10's precision is not strictly greater than x8's + x10 >> x9; // NON_COMPLIANT: x10's precision is not strictly greater than x9's + x10 >> + x10; // NON_COMPLIANT: x10's precision is not strictly greater than x10's + x10 >> + x11; // NON_COMPLIANT: x10's precision is not strictly greater than x11's + x10 >> + x12; // NON_COMPLIANT: x10's precision is not strictly greater than x12's + x10 >> + x13; // NON_COMPLIANT: x10's precision is not strictly greater than x13's + x10 >> + x14; // NON_COMPLIANT: x10's precision is not strictly greater than x14's + x11 >> x0; // COMPLIANT: x11's precision is strictly greater than x0's + x11 >> x1; // COMPLIANT: x11's precision is strictly greater than x1's + x11 >> x2; // COMPLIANT: x11's precision is strictly greater than x2's + x11 >> x3; // COMPLIANT: x11's precision is strictly greater than x3's + x11 >> x4; // COMPLIANT: x11's precision is strictly greater than x4's + x11 >> x5; // COMPLIANT: x11's precision is strictly greater than x5's + x11 >> x6; // NON_COMPLIANT: x11's precision is not strictly greater than x6's + x11 >> x7; // NON_COMPLIANT: x11's precision is not strictly greater than x7's + x11 >> x8; // NON_COMPLIANT: x11's precision is not strictly greater than x8's + x11 >> x9; // NON_COMPLIANT: x11's precision is not strictly greater than x9's + x11 >> + x10; // NON_COMPLIANT: x11's precision is not strictly greater than x10's + x11 >> + x11; // NON_COMPLIANT: x11's precision is not strictly greater than x11's + x11 >> + x12; // NON_COMPLIANT: x11's precision is not strictly greater than x12's + x11 >> + x13; // NON_COMPLIANT: x11's precision is not strictly greater than x13's + x11 >> + x14; // NON_COMPLIANT: x11's precision is not strictly greater than x14's + x12 >> x0; // COMPLIANT: x12's precision is strictly greater than x0's + x12 >> x1; // COMPLIANT: x12's precision is strictly greater than x1's + x12 >> x2; // COMPLIANT: x12's precision is strictly greater than x2's + x12 >> x3; // COMPLIANT: x12's precision is strictly greater than x3's + x12 >> x4; // COMPLIANT: x12's precision is strictly greater than x4's + x12 >> x5; // COMPLIANT: x12's precision is strictly greater than x5's + x12 >> x6; // COMPLIANT: x12's precision is strictly greater than x6's + x12 >> x7; // COMPLIANT: x12's precision is strictly greater than x7's + x12 >> x8; // COMPLIANT: x12's precision is strictly greater than x8's + x12 >> x9; // COMPLIANT: x12's precision is strictly greater than x9's + x12 >> x10; // COMPLIANT: x12's precision is strictly greater than x10's + x12 >> x11; // COMPLIANT: x12's precision is strictly greater than x11's + x12 >> + x12; // NON_COMPLIANT: x12's precision is not strictly greater than x12's + x12 >> x13; // COMPLIANT: x12's precision is strictly greater than x13's + x12 >> x14; // COMPLIANT: x12's precision is strictly greater than x14's + x13 >> x0; // COMPLIANT: x13's precision is strictly greater than x0's + x13 >> x1; // COMPLIANT: x13's precision is strictly greater than x1's + x13 >> x2; // COMPLIANT: x13's precision is strictly greater than x2's + x13 >> x3; // COMPLIANT: x13's precision is strictly greater than x3's + x13 >> x4; // COMPLIANT: x13's precision is strictly greater than x4's + x13 >> x5; // COMPLIANT: x13's precision is strictly greater than x5's + x13 >> x6; // COMPLIANT: x13's precision is strictly greater than x6's + x13 >> x7; // COMPLIANT: x13's precision is strictly greater than x7's + x13 >> x8; // COMPLIANT: x13's precision is strictly greater than x8's + x13 >> x9; // COMPLIANT: x13's precision is strictly greater than x9's + x13 >> x10; // COMPLIANT: x13's precision is strictly greater than x10's + x13 >> x11; // COMPLIANT: x13's precision is strictly greater than x11's + x13 >> + x12; // NON_COMPLIANT: x13's precision is not strictly greater than x12's + x13 >> + x13; // NON_COMPLIANT: x13's precision is not strictly greater than x13's + x13 >> + x14; // NON_COMPLIANT: x13's precision is not strictly greater than x14's + x14 >> x0; // COMPLIANT: x14's precision is strictly greater than x0's + x14 >> x1; // COMPLIANT: x14's precision is strictly greater than x1's + x14 >> x2; // COMPLIANT: x14's precision is strictly greater than x2's + x14 >> x3; // COMPLIANT: x14's precision is strictly greater than x3's + x14 >> x4; // COMPLIANT: x14's precision is strictly greater than x4's + x14 >> x5; // COMPLIANT: x14's precision is strictly greater than x5's + x14 >> x6; // COMPLIANT: x14's precision is strictly greater than x6's + x14 >> x7; // COMPLIANT: x14's precision is strictly greater than x7's + x14 >> x8; // COMPLIANT: x14's precision is strictly greater than x8's + x14 >> x9; // COMPLIANT: x14's precision is strictly greater than x9's + x14 >> x10; // COMPLIANT: x14's precision is strictly greater than x10's + x14 >> x11; // COMPLIANT: x14's precision is strictly greater than x11's + x14 >> + x12; // NON_COMPLIANT: x14's precision is not strictly greater than x12's + x14 >> + x13; // NON_COMPLIANT: x14's precision is not strictly greater than x13's + x14 >> + x14; // NON_COMPLIANT: x14's precision is not strictly greater than x14's + + /* negative shift */ + + x0 << -1; // NON_COMPLIANT: shifting by a negative operand + x1 << -1; // NON_COMPLIANT: shifting by a negative operand + x2 << -1; // NON_COMPLIANT: shifting by a negative operand + x3 << -1; // NON_COMPLIANT: shifting by a negative operand + x4 << -1; // NON_COMPLIANT: shifting by a negative operand + x5 << -1; // NON_COMPLIANT: shifting by a negative operand + x6 << -1; // NON_COMPLIANT: shifting by a negative operand + x7 << -1; // NON_COMPLIANT: shifting by a negative operand + x8 << -1; // NON_COMPLIANT: shifting by a negative operand + x9 << -1; // NON_COMPLIANT: shifting by a negative operand + x10 << -1; // NON_COMPLIANT: shifting by a negative operand + x11 << -1; // NON_COMPLIANT: shifting by a negative operand + x12 << -1; // NON_COMPLIANT: shifting by a negative operand + x13 << -1; // NON_COMPLIANT: shifting by a negative operand + x14 << -1; // NON_COMPLIANT: shifting by a negative operand + + return 0; +} \ No newline at end of file From 3d303168e0cfe7abba398ed79333a158b1566c40 Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Thu, 2 Mar 2023 15:15:35 -0800 Subject: [PATCH 20/53] Implement INT34-C --- ...ftedbyNegativeOrGreaterPrecisionOperand.ql | 64 +++- ...NegativeOrGreaterPrecisionOperand.expected | 276 +++++++++++++++++- 2 files changed, 336 insertions(+), 4 deletions(-) diff --git a/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql b/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql index 63de22a8cb..c59665a48b 100644 --- a/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql +++ b/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql @@ -13,7 +13,65 @@ import cpp import codingstandards.c.cert -from +/* Precision predicate based on a sample implementaion from https://wiki.sei.cmu.edu/confluence/display/c/INT35-C.+Use+correct+integer+precisions */ +int getPrecision(BuiltInType type) { + type.(CharType).isExplicitlyUnsigned() and result = 8 + or + type.(ShortType).isExplicitlyUnsigned() and result = 16 + or + type.(IntType).isExplicitlyUnsigned() and result = 32 + or + type.(LongType).isExplicitlyUnsigned() and result = 32 + or + type.(LongLongType).isExplicitlyUnsigned() and result = 64 + or + type instanceof CharType and not type.(CharType).isExplicitlyUnsigned() and result = 7 + or + type instanceof ShortType and not type.(ShortType).isExplicitlyUnsigned() and result = 15 + or + type instanceof IntType and not type.(IntType).isExplicitlyUnsigned() and result = 31 + or + type instanceof LongType and not type.(LongType).isExplicitlyUnsigned() and result = 31 + or + type instanceof LongLongType and not type.(LongLongType).isExplicitlyUnsigned() and result = 63 +} + +class MinusNumberLiteral extends UnaryMinusExpr { + MinusNumberLiteral() { this.getOperand() instanceof Literal } + + override string toString() { result = "-" + this.getOperand().toString() } +} + +class ForbiddenShiftExpr extends BinaryBitwiseOperation { + ForbiddenShiftExpr() { + ( + /* Precision mismatch between operands */ + getPrecision(this.(LShiftExpr).getLeftOperand().getUnderlyingType()) <= + getPrecision(this.(LShiftExpr).getRightOperand().getUnderlyingType()) or + getPrecision(this.(RShiftExpr).getLeftOperand().getUnderlyingType()) <= + getPrecision(this.(RShiftExpr).getRightOperand().getUnderlyingType()) or + /* Shifting by a negative number literal */ + this.(LShiftExpr).getRightOperand() instanceof MinusNumberLiteral or + this.(RShiftExpr).getRightOperand() instanceof MinusNumberLiteral + ) + } + + predicate hasNegativeOperand() { + this.(LShiftExpr).getRightOperand() instanceof MinusNumberLiteral or + this.(RShiftExpr).getRightOperand() instanceof MinusNumberLiteral + } +} + +from ForbiddenShiftExpr badShift, string message where - not isExcluded(x, TypesPackage::exprShiftedbyNegativeOrGreaterPrecisionOperandQuery()) and -select + not isExcluded(badShift, TypesPackage::exprShiftedbyNegativeOrGreaterPrecisionOperandQuery()) and + if badShift.hasNegativeOperand() + then + message = + "The operand " + badShift.getLeftOperand() + " is shifted by a negative expression " + + badShift.getRightOperand() + "." + else + message = + "The operand " + badShift.getLeftOperand() + " is shifted by an expression " + + badShift.getRightOperand() + " which is greater than or equal to in precision." +select badShift, message diff --git a/c/cert/test/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.expected b/c/cert/test/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.expected index 2ec1a0ac6c..f7d45166f3 100644 --- a/c/cert/test/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.expected +++ b/c/cert/test/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.expected @@ -1 +1,275 @@ -No expected results have yet been specified \ No newline at end of file +| test.c:20:3:20:10 | ... << ... | The operand x0 is shifted by an expression x0 which is greater than or equal to in precision. | +| test.c:23:3:23:10 | ... << ... | The operand x0 is shifted by an expression x3 which is greater than or equal to in precision. | +| test.c:24:3:24:10 | ... << ... | The operand x0 is shifted by an expression x4 which is greater than or equal to in precision. | +| test.c:25:3:25:10 | ... << ... | The operand x0 is shifted by an expression x5 which is greater than or equal to in precision. | +| test.c:26:3:26:10 | ... << ... | The operand x0 is shifted by an expression x6 which is greater than or equal to in precision. | +| test.c:27:3:27:10 | ... << ... | The operand x0 is shifted by an expression x7 which is greater than or equal to in precision. | +| test.c:28:3:28:10 | ... << ... | The operand x0 is shifted by an expression x8 which is greater than or equal to in precision. | +| test.c:29:3:29:10 | ... << ... | The operand x0 is shifted by an expression x9 which is greater than or equal to in precision. | +| test.c:30:3:30:11 | ... << ... | The operand x0 is shifted by an expression x10 which is greater than or equal to in precision. | +| test.c:31:3:31:11 | ... << ... | The operand x0 is shifted by an expression x11 which is greater than or equal to in precision. | +| test.c:32:3:32:11 | ... << ... | The operand x0 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:33:3:33:11 | ... << ... | The operand x0 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:34:3:34:11 | ... << ... | The operand x0 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:35:3:35:10 | ... << ... | The operand x1 is shifted by an expression x0 which is greater than or equal to in precision. | +| test.c:36:3:36:10 | ... << ... | The operand x1 is shifted by an expression x1 which is greater than or equal to in precision. | +| test.c:37:3:37:10 | ... << ... | The operand x1 is shifted by an expression x2 which is greater than or equal to in precision. | +| test.c:38:3:38:10 | ... << ... | The operand x1 is shifted by an expression x3 which is greater than or equal to in precision. | +| test.c:39:3:39:10 | ... << ... | The operand x1 is shifted by an expression x4 which is greater than or equal to in precision. | +| test.c:40:3:40:10 | ... << ... | The operand x1 is shifted by an expression x5 which is greater than or equal to in precision. | +| test.c:41:3:41:10 | ... << ... | The operand x1 is shifted by an expression x6 which is greater than or equal to in precision. | +| test.c:42:3:42:10 | ... << ... | The operand x1 is shifted by an expression x7 which is greater than or equal to in precision. | +| test.c:43:3:43:10 | ... << ... | The operand x1 is shifted by an expression x8 which is greater than or equal to in precision. | +| test.c:44:3:44:10 | ... << ... | The operand x1 is shifted by an expression x9 which is greater than or equal to in precision. | +| test.c:45:3:45:11 | ... << ... | The operand x1 is shifted by an expression x10 which is greater than or equal to in precision. | +| test.c:46:3:46:11 | ... << ... | The operand x1 is shifted by an expression x11 which is greater than or equal to in precision. | +| test.c:47:3:47:11 | ... << ... | The operand x1 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:48:3:48:11 | ... << ... | The operand x1 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:49:3:49:11 | ... << ... | The operand x1 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:50:3:50:10 | ... << ... | The operand x2 is shifted by an expression x0 which is greater than or equal to in precision. | +| test.c:51:3:51:10 | ... << ... | The operand x2 is shifted by an expression x1 which is greater than or equal to in precision. | +| test.c:52:3:52:10 | ... << ... | The operand x2 is shifted by an expression x2 which is greater than or equal to in precision. | +| test.c:53:3:53:10 | ... << ... | The operand x2 is shifted by an expression x3 which is greater than or equal to in precision. | +| test.c:54:3:54:10 | ... << ... | The operand x2 is shifted by an expression x4 which is greater than or equal to in precision. | +| test.c:55:3:55:10 | ... << ... | The operand x2 is shifted by an expression x5 which is greater than or equal to in precision. | +| test.c:56:3:56:10 | ... << ... | The operand x2 is shifted by an expression x6 which is greater than or equal to in precision. | +| test.c:57:3:57:10 | ... << ... | The operand x2 is shifted by an expression x7 which is greater than or equal to in precision. | +| test.c:58:3:58:10 | ... << ... | The operand x2 is shifted by an expression x8 which is greater than or equal to in precision. | +| test.c:59:3:59:10 | ... << ... | The operand x2 is shifted by an expression x9 which is greater than or equal to in precision. | +| test.c:60:3:60:11 | ... << ... | The operand x2 is shifted by an expression x10 which is greater than or equal to in precision. | +| test.c:61:3:61:11 | ... << ... | The operand x2 is shifted by an expression x11 which is greater than or equal to in precision. | +| test.c:62:3:62:11 | ... << ... | The operand x2 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:63:3:63:11 | ... << ... | The operand x2 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:64:3:64:11 | ... << ... | The operand x2 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:68:3:68:10 | ... << ... | The operand x3 is shifted by an expression x3 which is greater than or equal to in precision. | +| test.c:71:3:71:10 | ... << ... | The operand x3 is shifted by an expression x6 which is greater than or equal to in precision. | +| test.c:72:3:72:10 | ... << ... | The operand x3 is shifted by an expression x7 which is greater than or equal to in precision. | +| test.c:73:3:73:10 | ... << ... | The operand x3 is shifted by an expression x8 which is greater than or equal to in precision. | +| test.c:74:3:74:10 | ... << ... | The operand x3 is shifted by an expression x9 which is greater than or equal to in precision. | +| test.c:75:3:75:11 | ... << ... | The operand x3 is shifted by an expression x10 which is greater than or equal to in precision. | +| test.c:76:3:76:11 | ... << ... | The operand x3 is shifted by an expression x11 which is greater than or equal to in precision. | +| test.c:77:3:77:11 | ... << ... | The operand x3 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:78:3:78:11 | ... << ... | The operand x3 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:79:3:79:11 | ... << ... | The operand x3 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:83:3:83:10 | ... << ... | The operand x4 is shifted by an expression x3 which is greater than or equal to in precision. | +| test.c:84:3:84:10 | ... << ... | The operand x4 is shifted by an expression x4 which is greater than or equal to in precision. | +| test.c:85:3:85:10 | ... << ... | The operand x4 is shifted by an expression x5 which is greater than or equal to in precision. | +| test.c:86:3:86:10 | ... << ... | The operand x4 is shifted by an expression x6 which is greater than or equal to in precision. | +| test.c:87:3:87:10 | ... << ... | The operand x4 is shifted by an expression x7 which is greater than or equal to in precision. | +| test.c:88:3:88:10 | ... << ... | The operand x4 is shifted by an expression x8 which is greater than or equal to in precision. | +| test.c:89:3:89:10 | ... << ... | The operand x4 is shifted by an expression x9 which is greater than or equal to in precision. | +| test.c:90:3:90:11 | ... << ... | The operand x4 is shifted by an expression x10 which is greater than or equal to in precision. | +| test.c:91:3:91:11 | ... << ... | The operand x4 is shifted by an expression x11 which is greater than or equal to in precision. | +| test.c:92:3:92:11 | ... << ... | The operand x4 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:93:3:93:11 | ... << ... | The operand x4 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:94:3:94:11 | ... << ... | The operand x4 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:98:3:98:10 | ... << ... | The operand x5 is shifted by an expression x3 which is greater than or equal to in precision. | +| test.c:99:3:99:10 | ... << ... | The operand x5 is shifted by an expression x4 which is greater than or equal to in precision. | +| test.c:100:3:100:10 | ... << ... | The operand x5 is shifted by an expression x5 which is greater than or equal to in precision. | +| test.c:101:3:101:10 | ... << ... | The operand x5 is shifted by an expression x6 which is greater than or equal to in precision. | +| test.c:102:3:102:10 | ... << ... | The operand x5 is shifted by an expression x7 which is greater than or equal to in precision. | +| test.c:103:3:103:10 | ... << ... | The operand x5 is shifted by an expression x8 which is greater than or equal to in precision. | +| test.c:104:3:104:10 | ... << ... | The operand x5 is shifted by an expression x9 which is greater than or equal to in precision. | +| test.c:105:3:105:11 | ... << ... | The operand x5 is shifted by an expression x10 which is greater than or equal to in precision. | +| test.c:106:3:106:11 | ... << ... | The operand x5 is shifted by an expression x11 which is greater than or equal to in precision. | +| test.c:107:3:107:11 | ... << ... | The operand x5 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:108:3:108:11 | ... << ... | The operand x5 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:109:3:109:11 | ... << ... | The operand x5 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:116:3:116:10 | ... << ... | The operand x6 is shifted by an expression x6 which is greater than or equal to in precision. | +| test.c:119:3:119:10 | ... << ... | The operand x6 is shifted by an expression x9 which is greater than or equal to in precision. | +| test.c:122:3:122:11 | ... << ... | The operand x6 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:123:3:123:11 | ... << ... | The operand x6 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:124:3:124:11 | ... << ... | The operand x6 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:131:3:131:10 | ... << ... | The operand x7 is shifted by an expression x6 which is greater than or equal to in precision. | +| test.c:132:3:132:10 | ... << ... | The operand x7 is shifted by an expression x7 which is greater than or equal to in precision. | +| test.c:133:3:133:10 | ... << ... | The operand x7 is shifted by an expression x8 which is greater than or equal to in precision. | +| test.c:134:3:134:10 | ... << ... | The operand x7 is shifted by an expression x9 which is greater than or equal to in precision. | +| test.c:135:3:135:11 | ... << ... | The operand x7 is shifted by an expression x10 which is greater than or equal to in precision. | +| test.c:136:3:136:11 | ... << ... | The operand x7 is shifted by an expression x11 which is greater than or equal to in precision. | +| test.c:137:3:137:11 | ... << ... | The operand x7 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:138:3:138:11 | ... << ... | The operand x7 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:139:3:139:11 | ... << ... | The operand x7 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:146:3:146:10 | ... << ... | The operand x8 is shifted by an expression x6 which is greater than or equal to in precision. | +| test.c:147:3:147:10 | ... << ... | The operand x8 is shifted by an expression x7 which is greater than or equal to in precision. | +| test.c:148:3:148:10 | ... << ... | The operand x8 is shifted by an expression x8 which is greater than or equal to in precision. | +| test.c:149:3:149:10 | ... << ... | The operand x8 is shifted by an expression x9 which is greater than or equal to in precision. | +| test.c:150:3:150:11 | ... << ... | The operand x8 is shifted by an expression x10 which is greater than or equal to in precision. | +| test.c:151:3:151:11 | ... << ... | The operand x8 is shifted by an expression x11 which is greater than or equal to in precision. | +| test.c:152:3:152:11 | ... << ... | The operand x8 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:153:3:153:11 | ... << ... | The operand x8 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:154:3:154:11 | ... << ... | The operand x8 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:161:3:161:10 | ... << ... | The operand x9 is shifted by an expression x6 which is greater than or equal to in precision. | +| test.c:164:3:164:10 | ... << ... | The operand x9 is shifted by an expression x9 which is greater than or equal to in precision. | +| test.c:167:3:167:11 | ... << ... | The operand x9 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:168:3:168:11 | ... << ... | The operand x9 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:169:3:169:11 | ... << ... | The operand x9 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:176:3:176:11 | ... << ... | The operand x10 is shifted by an expression x6 which is greater than or equal to in precision. | +| test.c:177:3:177:11 | ... << ... | The operand x10 is shifted by an expression x7 which is greater than or equal to in precision. | +| test.c:178:3:178:11 | ... << ... | The operand x10 is shifted by an expression x8 which is greater than or equal to in precision. | +| test.c:179:3:179:11 | ... << ... | The operand x10 is shifted by an expression x9 which is greater than or equal to in precision. | +| test.c:180:3:180:12 | ... << ... | The operand x10 is shifted by an expression x10 which is greater than or equal to in precision. | +| test.c:182:3:182:12 | ... << ... | The operand x10 is shifted by an expression x11 which is greater than or equal to in precision. | +| test.c:184:3:184:12 | ... << ... | The operand x10 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:186:3:186:12 | ... << ... | The operand x10 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:188:3:188:12 | ... << ... | The operand x10 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:196:3:196:11 | ... << ... | The operand x11 is shifted by an expression x6 which is greater than or equal to in precision. | +| test.c:197:3:197:11 | ... << ... | The operand x11 is shifted by an expression x7 which is greater than or equal to in precision. | +| test.c:198:3:198:11 | ... << ... | The operand x11 is shifted by an expression x8 which is greater than or equal to in precision. | +| test.c:199:3:199:11 | ... << ... | The operand x11 is shifted by an expression x9 which is greater than or equal to in precision. | +| test.c:200:3:200:12 | ... << ... | The operand x11 is shifted by an expression x10 which is greater than or equal to in precision. | +| test.c:202:3:202:12 | ... << ... | The operand x11 is shifted by an expression x11 which is greater than or equal to in precision. | +| test.c:204:3:204:12 | ... << ... | The operand x11 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:206:3:206:12 | ... << ... | The operand x11 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:208:3:208:12 | ... << ... | The operand x11 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:222:3:222:12 | ... << ... | The operand x12 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:238:3:238:12 | ... << ... | The operand x13 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:240:3:240:12 | ... << ... | The operand x13 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:242:3:242:12 | ... << ... | The operand x13 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:256:3:256:12 | ... << ... | The operand x14 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:258:3:258:12 | ... << ... | The operand x14 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:260:3:260:12 | ... << ... | The operand x14 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:265:3:265:10 | ... >> ... | The operand x0 is shifted by an expression x0 which is greater than or equal to in precision. | +| test.c:268:3:268:10 | ... >> ... | The operand x0 is shifted by an expression x3 which is greater than or equal to in precision. | +| test.c:269:3:269:10 | ... >> ... | The operand x0 is shifted by an expression x4 which is greater than or equal to in precision. | +| test.c:270:3:270:10 | ... >> ... | The operand x0 is shifted by an expression x5 which is greater than or equal to in precision. | +| test.c:271:3:271:10 | ... >> ... | The operand x0 is shifted by an expression x6 which is greater than or equal to in precision. | +| test.c:272:3:272:10 | ... >> ... | The operand x0 is shifted by an expression x7 which is greater than or equal to in precision. | +| test.c:273:3:273:10 | ... >> ... | The operand x0 is shifted by an expression x8 which is greater than or equal to in precision. | +| test.c:274:3:274:10 | ... >> ... | The operand x0 is shifted by an expression x9 which is greater than or equal to in precision. | +| test.c:275:3:275:11 | ... >> ... | The operand x0 is shifted by an expression x10 which is greater than or equal to in precision. | +| test.c:276:3:276:11 | ... >> ... | The operand x0 is shifted by an expression x11 which is greater than or equal to in precision. | +| test.c:277:3:277:11 | ... >> ... | The operand x0 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:278:3:278:11 | ... >> ... | The operand x0 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:279:3:279:11 | ... >> ... | The operand x0 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:280:3:280:10 | ... >> ... | The operand x1 is shifted by an expression x0 which is greater than or equal to in precision. | +| test.c:281:3:281:10 | ... >> ... | The operand x1 is shifted by an expression x1 which is greater than or equal to in precision. | +| test.c:282:3:282:10 | ... >> ... | The operand x1 is shifted by an expression x2 which is greater than or equal to in precision. | +| test.c:283:3:283:10 | ... >> ... | The operand x1 is shifted by an expression x3 which is greater than or equal to in precision. | +| test.c:284:3:284:10 | ... >> ... | The operand x1 is shifted by an expression x4 which is greater than or equal to in precision. | +| test.c:285:3:285:10 | ... >> ... | The operand x1 is shifted by an expression x5 which is greater than or equal to in precision. | +| test.c:286:3:286:10 | ... >> ... | The operand x1 is shifted by an expression x6 which is greater than or equal to in precision. | +| test.c:287:3:287:10 | ... >> ... | The operand x1 is shifted by an expression x7 which is greater than or equal to in precision. | +| test.c:288:3:288:10 | ... >> ... | The operand x1 is shifted by an expression x8 which is greater than or equal to in precision. | +| test.c:289:3:289:10 | ... >> ... | The operand x1 is shifted by an expression x9 which is greater than or equal to in precision. | +| test.c:290:3:290:11 | ... >> ... | The operand x1 is shifted by an expression x10 which is greater than or equal to in precision. | +| test.c:291:3:291:11 | ... >> ... | The operand x1 is shifted by an expression x11 which is greater than or equal to in precision. | +| test.c:292:3:292:11 | ... >> ... | The operand x1 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:293:3:293:11 | ... >> ... | The operand x1 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:294:3:294:11 | ... >> ... | The operand x1 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:295:3:295:10 | ... >> ... | The operand x2 is shifted by an expression x0 which is greater than or equal to in precision. | +| test.c:296:3:296:10 | ... >> ... | The operand x2 is shifted by an expression x1 which is greater than or equal to in precision. | +| test.c:297:3:297:10 | ... >> ... | The operand x2 is shifted by an expression x2 which is greater than or equal to in precision. | +| test.c:298:3:298:10 | ... >> ... | The operand x2 is shifted by an expression x3 which is greater than or equal to in precision. | +| test.c:299:3:299:10 | ... >> ... | The operand x2 is shifted by an expression x4 which is greater than or equal to in precision. | +| test.c:300:3:300:10 | ... >> ... | The operand x2 is shifted by an expression x5 which is greater than or equal to in precision. | +| test.c:301:3:301:10 | ... >> ... | The operand x2 is shifted by an expression x6 which is greater than or equal to in precision. | +| test.c:302:3:302:10 | ... >> ... | The operand x2 is shifted by an expression x7 which is greater than or equal to in precision. | +| test.c:303:3:303:10 | ... >> ... | The operand x2 is shifted by an expression x8 which is greater than or equal to in precision. | +| test.c:304:3:304:10 | ... >> ... | The operand x2 is shifted by an expression x9 which is greater than or equal to in precision. | +| test.c:305:3:305:11 | ... >> ... | The operand x2 is shifted by an expression x10 which is greater than or equal to in precision. | +| test.c:306:3:306:11 | ... >> ... | The operand x2 is shifted by an expression x11 which is greater than or equal to in precision. | +| test.c:307:3:307:11 | ... >> ... | The operand x2 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:308:3:308:11 | ... >> ... | The operand x2 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:309:3:309:11 | ... >> ... | The operand x2 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:313:3:313:10 | ... >> ... | The operand x3 is shifted by an expression x3 which is greater than or equal to in precision. | +| test.c:316:3:316:10 | ... >> ... | The operand x3 is shifted by an expression x6 which is greater than or equal to in precision. | +| test.c:317:3:317:10 | ... >> ... | The operand x3 is shifted by an expression x7 which is greater than or equal to in precision. | +| test.c:318:3:318:10 | ... >> ... | The operand x3 is shifted by an expression x8 which is greater than or equal to in precision. | +| test.c:319:3:319:10 | ... >> ... | The operand x3 is shifted by an expression x9 which is greater than or equal to in precision. | +| test.c:320:3:320:11 | ... >> ... | The operand x3 is shifted by an expression x10 which is greater than or equal to in precision. | +| test.c:321:3:321:11 | ... >> ... | The operand x3 is shifted by an expression x11 which is greater than or equal to in precision. | +| test.c:322:3:322:11 | ... >> ... | The operand x3 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:323:3:323:11 | ... >> ... | The operand x3 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:324:3:324:11 | ... >> ... | The operand x3 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:328:3:328:10 | ... >> ... | The operand x4 is shifted by an expression x3 which is greater than or equal to in precision. | +| test.c:329:3:329:10 | ... >> ... | The operand x4 is shifted by an expression x4 which is greater than or equal to in precision. | +| test.c:330:3:330:10 | ... >> ... | The operand x4 is shifted by an expression x5 which is greater than or equal to in precision. | +| test.c:331:3:331:10 | ... >> ... | The operand x4 is shifted by an expression x6 which is greater than or equal to in precision. | +| test.c:332:3:332:10 | ... >> ... | The operand x4 is shifted by an expression x7 which is greater than or equal to in precision. | +| test.c:333:3:333:10 | ... >> ... | The operand x4 is shifted by an expression x8 which is greater than or equal to in precision. | +| test.c:334:3:334:10 | ... >> ... | The operand x4 is shifted by an expression x9 which is greater than or equal to in precision. | +| test.c:335:3:335:11 | ... >> ... | The operand x4 is shifted by an expression x10 which is greater than or equal to in precision. | +| test.c:336:3:336:11 | ... >> ... | The operand x4 is shifted by an expression x11 which is greater than or equal to in precision. | +| test.c:337:3:337:11 | ... >> ... | The operand x4 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:338:3:338:11 | ... >> ... | The operand x4 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:339:3:339:11 | ... >> ... | The operand x4 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:343:3:343:10 | ... >> ... | The operand x5 is shifted by an expression x3 which is greater than or equal to in precision. | +| test.c:344:3:344:10 | ... >> ... | The operand x5 is shifted by an expression x4 which is greater than or equal to in precision. | +| test.c:345:3:345:10 | ... >> ... | The operand x5 is shifted by an expression x5 which is greater than or equal to in precision. | +| test.c:346:3:346:10 | ... >> ... | The operand x5 is shifted by an expression x6 which is greater than or equal to in precision. | +| test.c:347:3:347:10 | ... >> ... | The operand x5 is shifted by an expression x7 which is greater than or equal to in precision. | +| test.c:348:3:348:10 | ... >> ... | The operand x5 is shifted by an expression x8 which is greater than or equal to in precision. | +| test.c:349:3:349:10 | ... >> ... | The operand x5 is shifted by an expression x9 which is greater than or equal to in precision. | +| test.c:350:3:350:11 | ... >> ... | The operand x5 is shifted by an expression x10 which is greater than or equal to in precision. | +| test.c:351:3:351:11 | ... >> ... | The operand x5 is shifted by an expression x11 which is greater than or equal to in precision. | +| test.c:352:3:352:11 | ... >> ... | The operand x5 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:353:3:353:11 | ... >> ... | The operand x5 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:354:3:354:11 | ... >> ... | The operand x5 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:361:3:361:10 | ... >> ... | The operand x6 is shifted by an expression x6 which is greater than or equal to in precision. | +| test.c:364:3:364:10 | ... >> ... | The operand x6 is shifted by an expression x9 which is greater than or equal to in precision. | +| test.c:367:3:367:11 | ... >> ... | The operand x6 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:368:3:368:11 | ... >> ... | The operand x6 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:369:3:369:11 | ... >> ... | The operand x6 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:376:3:376:10 | ... >> ... | The operand x7 is shifted by an expression x6 which is greater than or equal to in precision. | +| test.c:377:3:377:10 | ... >> ... | The operand x7 is shifted by an expression x7 which is greater than or equal to in precision. | +| test.c:378:3:378:10 | ... >> ... | The operand x7 is shifted by an expression x8 which is greater than or equal to in precision. | +| test.c:379:3:379:10 | ... >> ... | The operand x7 is shifted by an expression x9 which is greater than or equal to in precision. | +| test.c:380:3:380:11 | ... >> ... | The operand x7 is shifted by an expression x10 which is greater than or equal to in precision. | +| test.c:381:3:381:11 | ... >> ... | The operand x7 is shifted by an expression x11 which is greater than or equal to in precision. | +| test.c:382:3:382:11 | ... >> ... | The operand x7 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:383:3:383:11 | ... >> ... | The operand x7 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:384:3:384:11 | ... >> ... | The operand x7 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:391:3:391:10 | ... >> ... | The operand x8 is shifted by an expression x6 which is greater than or equal to in precision. | +| test.c:392:3:392:10 | ... >> ... | The operand x8 is shifted by an expression x7 which is greater than or equal to in precision. | +| test.c:393:3:393:10 | ... >> ... | The operand x8 is shifted by an expression x8 which is greater than or equal to in precision. | +| test.c:394:3:394:10 | ... >> ... | The operand x8 is shifted by an expression x9 which is greater than or equal to in precision. | +| test.c:395:3:395:11 | ... >> ... | The operand x8 is shifted by an expression x10 which is greater than or equal to in precision. | +| test.c:396:3:396:11 | ... >> ... | The operand x8 is shifted by an expression x11 which is greater than or equal to in precision. | +| test.c:397:3:397:11 | ... >> ... | The operand x8 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:398:3:398:11 | ... >> ... | The operand x8 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:399:3:399:11 | ... >> ... | The operand x8 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:406:3:406:10 | ... >> ... | The operand x9 is shifted by an expression x6 which is greater than or equal to in precision. | +| test.c:409:3:409:10 | ... >> ... | The operand x9 is shifted by an expression x9 which is greater than or equal to in precision. | +| test.c:412:3:412:11 | ... >> ... | The operand x9 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:413:3:413:11 | ... >> ... | The operand x9 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:414:3:414:11 | ... >> ... | The operand x9 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:421:3:421:11 | ... >> ... | The operand x10 is shifted by an expression x6 which is greater than or equal to in precision. | +| test.c:422:3:422:11 | ... >> ... | The operand x10 is shifted by an expression x7 which is greater than or equal to in precision. | +| test.c:423:3:423:11 | ... >> ... | The operand x10 is shifted by an expression x8 which is greater than or equal to in precision. | +| test.c:424:3:424:11 | ... >> ... | The operand x10 is shifted by an expression x9 which is greater than or equal to in precision. | +| test.c:425:3:426:9 | ... >> ... | The operand x10 is shifted by an expression x10 which is greater than or equal to in precision. | +| test.c:427:3:428:9 | ... >> ... | The operand x10 is shifted by an expression x11 which is greater than or equal to in precision. | +| test.c:429:3:430:9 | ... >> ... | The operand x10 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:431:3:432:9 | ... >> ... | The operand x10 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:433:3:434:9 | ... >> ... | The operand x10 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:441:3:441:11 | ... >> ... | The operand x11 is shifted by an expression x6 which is greater than or equal to in precision. | +| test.c:442:3:442:11 | ... >> ... | The operand x11 is shifted by an expression x7 which is greater than or equal to in precision. | +| test.c:443:3:443:11 | ... >> ... | The operand x11 is shifted by an expression x8 which is greater than or equal to in precision. | +| test.c:444:3:444:11 | ... >> ... | The operand x11 is shifted by an expression x9 which is greater than or equal to in precision. | +| test.c:445:3:446:9 | ... >> ... | The operand x11 is shifted by an expression x10 which is greater than or equal to in precision. | +| test.c:447:3:448:9 | ... >> ... | The operand x11 is shifted by an expression x11 which is greater than or equal to in precision. | +| test.c:449:3:450:9 | ... >> ... | The operand x11 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:451:3:452:9 | ... >> ... | The operand x11 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:453:3:454:9 | ... >> ... | The operand x11 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:467:3:468:9 | ... >> ... | The operand x12 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:483:3:484:9 | ... >> ... | The operand x13 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:485:3:486:9 | ... >> ... | The operand x13 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:487:3:488:9 | ... >> ... | The operand x13 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:501:3:502:9 | ... >> ... | The operand x14 is shifted by an expression x12 which is greater than or equal to in precision. | +| test.c:503:3:504:9 | ... >> ... | The operand x14 is shifted by an expression x13 which is greater than or equal to in precision. | +| test.c:505:3:506:9 | ... >> ... | The operand x14 is shifted by an expression x14 which is greater than or equal to in precision. | +| test.c:510:3:510:10 | ... << ... | The operand x0 is shifted by a negative expression -1. | +| test.c:511:3:511:10 | ... << ... | The operand x1 is shifted by a negative expression -1. | +| test.c:512:3:512:10 | ... << ... | The operand x2 is shifted by a negative expression -1. | +| test.c:513:3:513:10 | ... << ... | The operand x3 is shifted by a negative expression -1. | +| test.c:514:3:514:10 | ... << ... | The operand x4 is shifted by a negative expression -1. | +| test.c:515:3:515:10 | ... << ... | The operand x5 is shifted by a negative expression -1. | +| test.c:516:3:516:10 | ... << ... | The operand x6 is shifted by a negative expression -1. | +| test.c:517:3:517:10 | ... << ... | The operand x7 is shifted by a negative expression -1. | +| test.c:518:3:518:10 | ... << ... | The operand x8 is shifted by a negative expression -1. | +| test.c:519:3:519:10 | ... << ... | The operand x9 is shifted by a negative expression -1. | +| test.c:520:3:520:11 | ... << ... | The operand x10 is shifted by a negative expression -1. | +| test.c:521:3:521:11 | ... << ... | The operand x11 is shifted by a negative expression -1. | +| test.c:522:3:522:11 | ... << ... | The operand x12 is shifted by a negative expression -1. | +| test.c:523:3:523:11 | ... << ... | The operand x13 is shifted by a negative expression -1. | +| test.c:524:3:524:11 | ... << ... | The operand x14 is shifted by a negative expression -1. | From 9ddb2c65ed71ecfb33b06d7b39bdbb912a955893 Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Thu, 2 Mar 2023 22:37:34 -0800 Subject: [PATCH 21/53] Draft for INT36-C --- ...tingAPointerToIntegerOrIntegerToPointer.ql | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql b/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql index f63fa16f68..cd241557e1 100644 --- a/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql +++ b/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql @@ -13,7 +13,26 @@ import cpp import codingstandards.c.cert -from +/* 1. Declaring an integer variable to hold a pointer value */ +predicate integerVariableWithPointerValue(Variable var) { + var.getUnderlyingType() instanceof IntType and + var.getAnAssignedValue().getUnderlyingType() instanceof PointerType +} + +/* 2. Assigning an integer variable a pointer a pointer value */ +predicate assigningPointerValueToInteger(Assignment assign) { + assign.getLValue().getUnderlyingType() instanceof IntType and + assign.getRValue().getUnderlyingType() instanceof PointerType +} + +/* 3. Casting a pointer value to integer */ +predicate castingPointerToInteger(Cast cast) { + cast.getExpr().getUnderlyingType() instanceof PointerType and + cast.getUnderlyingType() instanceof PointerType +} + +from Variable x where not isExcluded(x, TypesPackage::convertingAPointerToIntegerOrIntegerToPointerQuery()) and -select + x.getType() instanceof PointerType +select x, x.getType().getAPrimaryQlClass() From 0b242cb0a48bdab251d8d75f8ab8dd03f7986f76 Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Fri, 3 Mar 2023 11:57:15 -0800 Subject: [PATCH 22/53] Add test.c for INT36-C --- c/cert/test/rules/INT36-C/test.c | 60 ++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 c/cert/test/rules/INT36-C/test.c diff --git a/c/cert/test/rules/INT36-C/test.c b/c/cert/test/rules/INT36-C/test.c new file mode 100644 index 0000000000..c4c7487502 --- /dev/null +++ b/c/cert/test/rules/INT36-C/test.c @@ -0,0 +1,60 @@ +#include + +int main() { + /* Compliant declarations and assignments */ + int integer1 = 1; // COMPLIANT: declaring integer as integer + int integer2 = integer1; // COMPLIANT: declaring integer as integer + integer1 = + integer2; // COMPLIANT: assigning integer rvalue to integer variable + int *int_pointer1 = + &integer1; // COMPLIANT: declaring pointer variable as an address + int *int_pointer2 = int_pointer1; // COMPLIANT: declaring pointer variable as + // an address rvalue + int_pointer1 = + int_pointer2; // COMPLIANT: assigning pointer rvalue to a pointer variable + + /* Integer to pointer */ + int *int_pointer3 = 0x01abcdef; // NON_COMPLIANT: declaring pointer variable + // with raw hex integer + int_pointer3 = + 0x01abcdef; // NON_COMPLIANT: assigning raw hex to pointer variable + int *int_pointer4 = + integer1; // NON_COMPLIANT: declaring pointer variable with integer value + *int_pointer4 = + integer1 + + 1; // NON_COMPLIANT: assigning integer rvalue to pointer variable + int *integer_address5 = + (int *)0x01abcdef; // NON_COMPLIANT: casting raw hex to pointer type + int *integer_address6 = + (int *)integer1; // NON_COMPLIANT: casting integer value to pointer type + + /* Pointer to integer */ + int *integer_address7 = + &integer1; // COMPLIANT: declaring pointer variable as an address + int integer_address8 = &integer1; // NON_COMPLIANT: declaring integer + // variable with pointer type value + integer_address8 = &integer1; // NON_COMPLIANT: assigning pointer type rvalue + // to integer variable + int integer_address = + (int)&integer1; // NON_COMPLIANT: casting pointer value to integer type + + /* Exceptions that are COMPLIANT */ + int *null_pointer1 = + 0; // COMPLIANT: integer 0 converted to pointer becomes null pointer + int *null_pointer2 = (int *)0; // COMPLIANT: integer 0 is converted to pointer + // becomes null pointer + null_pointer2 = + 0; // COMPLIANT: integer 0 converted to pointer becomes null pointer + + void *void_pointer = &integer1; + intptr_t void_pointer_integer1 = + void_pointer; // COMPLIANT: void pointer can be converted to intptr_t + uintptr_t void_pointer_integer2 = + void_pointer; // COMPLIANT: void pointer can be converted to uintptr_t + void *void_pointer1 = (void *) + void_pointer_integer1; // COMPLIANT: intptr_t can be converted to void* + void *void_pointer2 = (void *) + void_pointer_integer2; // COMPLIANT: uintptr_t can be converted to void* + + return 0; +} \ No newline at end of file From 2c36364459f0e1d88ea6be704b054c6a6d3a8c68 Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Fri, 3 Mar 2023 12:25:58 -0800 Subject: [PATCH 23/53] Implement INT36-C --- ...tingAPointerToIntegerOrIntegerToPointer.ql | 93 +++++++++++++++---- ...ointerToIntegerOrIntegerToPointer.expected | 12 ++- 2 files changed, 88 insertions(+), 17 deletions(-) diff --git a/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql b/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql index cd241557e1..6df573885b 100644 --- a/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql +++ b/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql @@ -13,26 +13,87 @@ import cpp import codingstandards.c.cert -/* 1. Declaring an integer variable to hold a pointer value */ -predicate integerVariableWithPointerValue(Variable var) { - var.getUnderlyingType() instanceof IntType and - var.getAnAssignedValue().getUnderlyingType() instanceof PointerType +class LiteralZero extends Literal { + LiteralZero() { this.getValue() = "0" } } -/* 2. Assigning an integer variable a pointer a pointer value */ -predicate assigningPointerValueToInteger(Assignment assign) { - assign.getLValue().getUnderlyingType() instanceof IntType and - assign.getRValue().getUnderlyingType() instanceof PointerType +class StdIntIntPtrType extends IntPointerType { + StdIntIntPtrType() { + this.getFile().(HeaderFile).getBaseName() = "stdint.h" and + this.getName().regexpMatch("u?intptr_t") + } } -/* 3. Casting a pointer value to integer */ -predicate castingPointerToInteger(Cast cast) { - cast.getExpr().getUnderlyingType() instanceof PointerType and - cast.getUnderlyingType() instanceof PointerType +/* 1. Declaring an integer variable to hold a pointer value or the opposite, excluding compliant exceptions */ +predicate integerVariableWithPointerValue(Variable var, string message) { + ( + // Declaring an integer variable to hold a pointer value + var.getUnderlyingType() instanceof IntType and + var.getAnAssignedValue().getUnderlyingType() instanceof PointerType and + message = + "Integer variable " + var + " is declared as an expression " + var.getAnAssignedValue() + + ", which is of a pointer type." + or + // Declaring an pointer variable to hold a integer value + var.getUnderlyingType() instanceof PointerType and + var.getAnAssignedValue().getUnderlyingType() instanceof IntType and + message = + "Pointer variable " + var + " is declared as an expression " + var.getAnAssignedValue() + + ", which is of integer type." + ) and + /* Compliant exception 1: literal 0 */ + not var.getAnAssignedValue() instanceof LiteralZero and + /* Compliant exception 2: variable's declared type is (u)intptr_t */ + not var.getUnderlyingType() instanceof StdIntIntPtrType } -from Variable x +/* 2. Assigning an integer variable a pointer a pointer value, excluding literal 0 */ +predicate assigningPointerValueToInteger(Assignment assign, string message) { + ( + assign.getLValue().getUnderlyingType() instanceof IntType and + assign.getRValue().getUnderlyingType() instanceof PointerType and + message = + "Integer variable " + assign.getLValue() + " is assigned an expression " + assign.getRValue() + + ", which is of a pointer type." + or + assign.getLValue().getUnderlyingType() instanceof PointerType and + assign.getRValue().getUnderlyingType() instanceof IntType and + message = + "Pointer variable " + assign.getLValue() + " is assigned an expression " + assign.getRValue() + + ", which is of integer type." + ) and + /* Compliant exception 1: literal 0 */ + not assign.getRValue() instanceof LiteralZero and + /* Compliant exception 2: variable's declared type is (u)intptr_t */ + not assign.getLValue().getUnderlyingType() instanceof StdIntIntPtrType +} + +/* 3. Casting a pointer value to integer, excluding literal 0 */ +predicate castingPointerToInteger(Cast cast, string message) { + not cast.isCompilerGenerated() and + ( + cast.getExpr().getUnderlyingType() instanceof IntType and + cast.getUnderlyingType() instanceof PointerType and + message = "Integer expression " + cast.getExpr() + " is cast to a pointer type." + or + cast.getExpr().getUnderlyingType() instanceof PointerType and + cast.getUnderlyingType() instanceof IntType and + message = "Pointer expression " + cast.getExpr() + " is cast to integer type." + ) and + /* Compliant exception 1: literal 0 */ + not cast.getExpr() instanceof LiteralZero and + /* Compliant exception 2: variable's declared type is (u)intptr_t */ + not cast.getUnderlyingType() instanceof StdIntIntPtrType +} + +from Element elem, string message where - not isExcluded(x, TypesPackage::convertingAPointerToIntegerOrIntegerToPointerQuery()) and - x.getType() instanceof PointerType -select x, x.getType().getAPrimaryQlClass() + not isExcluded(elem, TypesPackage::convertingAPointerToIntegerOrIntegerToPointerQuery()) and + ( + integerVariableWithPointerValue(elem, message) + or + assigningPointerValueToInteger(elem, message) + or + castingPointerToInteger(elem, message) + ) +select elem, message diff --git a/c/cert/test/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.expected b/c/cert/test/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.expected index 2ec1a0ac6c..fc119af0b2 100644 --- a/c/cert/test/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.expected +++ b/c/cert/test/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.expected @@ -1 +1,11 @@ -No expected results have yet been specified \ No newline at end of file +| test.c:17:8:17:19 | int_pointer3 | Pointer variable int_pointer3 is declared as an expression 28036591, which is of integer type. | +| test.c:19:3:20:16 | ... = ... | Pointer variable int_pointer3 is assigned an expression 28036591, which is of integer type. | +| test.c:21:8:21:19 | int_pointer4 | Pointer variable int_pointer4 is declared as an expression integer1, which is of integer type. | +| test.c:26:8:26:23 | integer_address5 | Pointer variable integer_address5 is declared as an expression 28036591, which is of integer type. | +| test.c:27:7:27:23 | (int *)... | Integer expression 28036591 is cast to a pointer type. | +| test.c:28:8:28:23 | integer_address6 | Pointer variable integer_address6 is declared as an expression integer1, which is of integer type. | +| test.c:29:7:29:21 | (int *)... | Integer expression integer1 is cast to a pointer type. | +| test.c:34:7:34:22 | integer_address8 | Integer variable integer_address8 is declared as an expression & ..., which is of a pointer type. | +| test.c:36:3:36:30 | ... = ... | Integer variable integer_address8 is assigned an expression & ..., which is of a pointer type. | +| test.c:38:7:38:21 | integer_address | Integer variable integer_address is declared as an expression & ..., which is of a pointer type. | +| test.c:39:7:39:20 | (int)... | Pointer expression & ... is cast to integer type. | From 20bc3ab771999f595871e05093b4617273f09baa Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Fri, 3 Mar 2023 12:43:48 -0800 Subject: [PATCH 24/53] Some minor comment adjustments --- ...ftedbyNegativeOrGreaterPrecisionOperand.ql | 12 +++- .../StringLiteralAssignedToNonConstChar.ql | 61 ++++++------------- 2 files changed, 27 insertions(+), 46 deletions(-) diff --git a/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql b/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql index c59665a48b..1eb6459628 100644 --- a/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql +++ b/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql @@ -13,7 +13,11 @@ import cpp import codingstandards.c.cert -/* Precision predicate based on a sample implementaion from https://wiki.sei.cmu.edu/confluence/display/c/INT35-C.+Use+correct+integer+precisions */ +/* + * Precision predicate based on a sample implementaion from + * https://wiki.sei.cmu.edu/confluence/display/c/INT35-C.+Use+correct+integer+precisions + */ + int getPrecision(BuiltInType type) { type.(CharType).isExplicitlyUnsigned() and result = 8 or @@ -36,6 +40,7 @@ int getPrecision(BuiltInType type) { type instanceof LongLongType and not type.(LongLongType).isExplicitlyUnsigned() and result = 63 } +/* The -1 number literal. */ class MinusNumberLiteral extends UnaryMinusExpr { MinusNumberLiteral() { this.getOperand() instanceof Literal } @@ -45,17 +50,18 @@ class MinusNumberLiteral extends UnaryMinusExpr { class ForbiddenShiftExpr extends BinaryBitwiseOperation { ForbiddenShiftExpr() { ( - /* Precision mismatch between operands */ + /* First Case: Precision mismatch between operands */ getPrecision(this.(LShiftExpr).getLeftOperand().getUnderlyingType()) <= getPrecision(this.(LShiftExpr).getRightOperand().getUnderlyingType()) or getPrecision(this.(RShiftExpr).getLeftOperand().getUnderlyingType()) <= getPrecision(this.(RShiftExpr).getRightOperand().getUnderlyingType()) or - /* Shifting by a negative number literal */ + /* Second Case: Shifting by a negative number literal */ this.(LShiftExpr).getRightOperand() instanceof MinusNumberLiteral or this.(RShiftExpr).getRightOperand() instanceof MinusNumberLiteral ) } + /* Second Case: Shifting by a negative number literal */ predicate hasNegativeOperand() { this.(LShiftExpr).getRightOperand() instanceof MinusNumberLiteral or this.(RShiftExpr).getRightOperand() instanceof MinusNumberLiteral diff --git a/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql b/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql index 73d91df642..e1a8c39fde 100644 --- a/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql +++ b/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql @@ -21,80 +21,55 @@ class NonConstCharStarType extends Type { } /* A non-const-char* variable declared with a string literal */ -predicate declaringNonConstCharVar(Variable decl) { +predicate declaringNonConstCharVar(Variable decl, string message) { not decl instanceof Parameter and // exclude parameters /* It should be declaring a char* type variable */ decl.getUnspecifiedType() instanceof CharPointerType and not decl.getUnderlyingType().isDeeplyConstBelow() and /* But it's declared to hold a string literal. */ - decl.getInitializer().getExpr() instanceof StringLiteral + decl.getInitializer().getExpr() instanceof StringLiteral and + message = "char* variable " + decl + " is declared with a string literal." } /* String literal being assigned to a non-const-char* variable */ -predicate assignmentToNonConstCharVar(Assignment assign) { +predicate assignmentToNonConstCharVar(Assignment assign, string message) { /* The variable being assigned is char* */ assign.getLValue().getUnderlyingType() instanceof NonConstCharStarType and /* But the rvalue is a string literal */ - exists(Expr rvalue | rvalue = assign.getRValue() | rvalue instanceof StringLiteral) + exists(Expr rvalue | rvalue = assign.getRValue() | rvalue instanceof StringLiteral) and + message = "char* variable " + assign.getLValue() + " is assigned a string literal. " } /* String literal being passed to a non-const-char* parameter */ -predicate assignmentToNonConstCharParam(FunctionCall call) { +predicate assignmentToNonConstCharParam(FunctionCall call, string message) { exists(int index | /* Param at index is a char* */ call.getTarget().getParameter(index).getUnderlyingType() instanceof NonConstCharStarType and /* But a string literal is passed */ call.getArgument(index) instanceof StringLiteral - ) + ) and + message = "char* parameter of " + call.getTarget() + " is passed a string literal." } /* String literal being returned by a non-const-char* function */ -predicate returningNonConstCharVar(ReturnStmt return) { +predicate returningNonConstCharVar(ReturnStmt return, string message) { /* The function is declared to return a char* */ return.getEnclosingFunction().getType().resolveTypedefs() instanceof NonConstCharStarType and /* But in reality it returns a string literal */ - return.getExpr() instanceof StringLiteral + return.getExpr() instanceof StringLiteral and + message = "char* function " + return.getEnclosingFunction() + " is returning a string literal." } -// newtype TProblematicElem = -// TVar(Variable decl) or -// TAssign(Assignment assign) or -// TFunCall(FunctionCall call) or -// TReturnStmt(ReturnStmt return) -// class ProblematicElem extends TProblematicElem { -// Variable getVariable() { this = TVar(result) } -// Assignment getAssign() { this = TAssign(result) } -// FunctionCall getFunCall() { this = TFunCall(result) } -// ReturnStmt getReturnStmt() { this = TReturnStmt(result) } -// override string toString() { -// this instanceof TVar and result = this.getVariable().toString() -// or -// this instanceof TAssign and result = this.getAssign().toString() -// or -// this instanceof TFunCall and result = this.getFunCall().toString() -// or -// this instanceof TReturnStmt and result = this.getReturnStmt().toString() -// } -// } -// class ProblematicElem = Variable or Assignment or FunctionCall or ReturnStmt; -// ^ Nope! -from Variable decl, Assignment assign, FunctionCall call, ReturnStmt return, string message +from Element elem, string message where - not isExcluded(decl, TypesPackage::stringLiteralAssignedToNonConstCharQuery()) and - not isExcluded(assign, TypesPackage::stringLiteralAssignedToNonConstCharQuery()) and - not isExcluded(call, TypesPackage::stringLiteralAssignedToNonConstCharQuery()) and - not isExcluded(return, TypesPackage::stringLiteralAssignedToNonConstCharQuery()) and + not isExcluded(elem, TypesPackage::stringLiteralAssignedToNonConstCharQuery()) and ( - declaringNonConstCharVar(decl) and - message = "char* variable " + decl + " is declared with a string literal." + declaringNonConstCharVar(elem, message) or - assignmentToNonConstCharVar(assign) and - message = "char* variable " + assign.getLValue() + " is assigned a string literal. " + assignmentToNonConstCharVar(elem, message) or - assignmentToNonConstCharParam(call) and - message = "char* parameter of " + call.getTarget() + " is passed a string literal." + assignmentToNonConstCharParam(elem, message) or - returningNonConstCharVar(return) and - message = "char* function " + return.getEnclosingFunction() + " is returning a string literal." + returningNonConstCharVar(elem, message) ) select message From 887c215e48e5a5db96cda33358c29083c4beab7c Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Fri, 3 Mar 2023 12:52:52 -0800 Subject: [PATCH 25/53] Add missing help query help file for INT36-c --- ...tingAPointerToIntegerOrIntegerToPointer.md | 202 +++++++++++++++++- 1 file changed, 200 insertions(+), 2 deletions(-) diff --git a/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.md b/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.md index f2fd9caa6e..1b4662ab74 100644 --- a/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.md +++ b/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.md @@ -5,9 +5,207 @@ This query implements the CERT-C rule INT36-C: > Converting a pointer to integer or integer to pointer -## CERT +## Description + +Although programmers often use integers and pointers interchangeably in C, pointer-to-integer and integer-to-pointer conversions are [implementation-defined](https://wiki.sei.cmu.edu/confluence/display/c/BB.+Definitions#BB.Definitions-implementation-definedbehavior). + +Conversions between integers and pointers can have undesired consequences depending on the [implementation](https://wiki.sei.cmu.edu/confluence/display/c/BB.+Definitions#BB.Definitions-implementation). According to the C Standard, subclause 6.3.2.3 \[[ISO/IEC 9899:2011](https://wiki.sei.cmu.edu/confluence/display/c/AA.+Bibliography#AA.Bibliography-ISO-IEC9899-2011)\], + +> An integer may be converted to any pointer type. Except as previously specified, the result is implementation-defined, might not be correctly aligned, might not point to an entity of the referenced type, and might be a trap representation. + + +> Any pointer type may be converted to an integer type. Except as previously specified, the result is implementation-defined. If the result cannot be represented in the integer type, the behavior is undefined. The result need not be in the range of values of any integer type. + + +Do not convert an integer type to a pointer type if the resulting pointer is incorrectly aligned, does not point to an entity of the referenced type, or is a [trap representation](https://wiki.sei.cmu.edu/confluence/display/c/BB.+Definitions#BB.Definitions-traprepresentation). + +Do not convert a pointer type to an integer type if the result cannot be represented in the integer type. (See [undefined behavior 24](https://wiki.sei.cmu.edu/confluence/display/c/CC.+Undefined+Behavior#CC.UndefinedBehavior-ub_24).) + +The mapping between pointers and integers must be consistent with the addressing structure of the execution environment. Issues may arise, for example, on architectures that have a segmented memory model. + +## Noncompliant Code Example + +The size of a pointer can be greater than the size of an integer, such as in an implementation where pointers are 64 bits and unsigned integers are 32 bits. This code example is noncompliant on such implementations because the result of converting the 64-bit `ptr` cannot be represented in the 32-bit integer type: + +```cpp +void f(void) { + char *ptr; + /* ... */ + unsigned int number = (unsigned int)ptr; + /* ... */ +} + +``` + +## Compliant Solution + +Any valid pointer to `void` can be converted to `intptr_t` or `uintptr_t` and back with no change in value. (See **INT36-EX2**.) The C Standard guarantees that a pointer to `void` may be converted to or from a pointer to any object type and back again and that the result must compare equal to the original pointer. Consequently, converting directly from a `char *` pointer to a `uintptr_t`, as in this compliant solution, is allowed on implementations that support the `uintptr_t` type. + +```cpp +#include + +void f(void) { + char *ptr; + /* ... */ + uintptr_t number = (uintptr_t)ptr; + /* ... */ +} + +``` + +## Noncompliant Code Example + +In this noncompliant code example, the pointer `ptr` is converted to an integer value. The high-order 9 bits of the number are used to hold a flag value, and the result is converted back into a pointer. This example is noncompliant on an implementation where pointers are 64 bits and unsigned integers are 32 bits because the result of converting the 64-bit `ptr` cannot be represented in the 32-bit integer type. + +```cpp +void func(unsigned int flag) { + char *ptr; + /* ... */ + unsigned int number = (unsigned int)ptr; + number = (number & 0x7fffff) | (flag << 23); + ptr = (char *)number; +} + +``` +A similar scheme was used in early versions of Emacs, limiting its portability and preventing the ability to edit files larger than 8MB. + +## Compliant Solution + +This compliant solution uses a `struct` to provide storage for both the pointer and the flag value. This solution is portable to machines of different word sizes, both smaller and larger than 32 bits, working even when pointers cannot be represented in any integer type. + +```cpp +struct ptrflag { + char *pointer; + unsigned int flag : 9; +} ptrflag; + +void func(unsigned int flag) { + char *ptr; + /* ... */ + ptrflag.pointer = ptr; + ptrflag.flag = flag; +} + +``` + +## Noncompliant Code Example + +It is sometimes necessary to access memory at a specific location, requiring a literal integer to pointer conversion. In this noncompliant code, a pointer is set directly to an integer constant, where it is unknown whether the result will be as intended: + +```cpp +unsigned int *g(void) { + unsigned int *ptr = 0xdeadbeef; + /* ... */ + return ptr; +} +``` +The result of this assignment is [implementation-defined](https://wiki.sei.cmu.edu/confluence/display/c/BB.+Definitions#BB.Definitions-implementation-definedbehavior), might not be correctly aligned, might not point to an entity of the referenced type, and might be a [trap representation](https://wiki.sei.cmu.edu/confluence/display/c/BB.+Definitions#BB.Definitions-traprepresentation). + +## Compliant Solution + +Unfortunately this code cannot be made safe while strictly conforming to ISO C. + +A particular platform (that is, hardware, operating system, compiler, and Standard C library) might guarantee that a memory address is correctly aligned for the pointer type, and actually contains a value for that type. A common practice is to use addresses that are known to point to hardware that provides valid values. + +## Exceptions + +**INT36-C-EX1:** The integer value 0 can be converted to a pointer; it becomes the null pointer. + +**INT36-C-EX2:** Any valid pointer to `void` can be converted to `intptr_t` or `uintptr_t` or their underlying types and back again with no change in value. Use of underlying types instead of `intptr_t` or `uintptr_t` is discouraged, however, because it limits portability. + +```cpp +#include +#include + +void h(void) { + intptr_t i = (intptr_t)(void *)&i; + uintptr_t j = (uintptr_t)(void *)&j; + + void *ip = (void *)i; + void *jp = (void *)j; + + assert(ip == &i); + assert(jp == &j); +} + +``` + +## Risk Assessment + +Converting from pointer to integer or vice versa results in code that is not portable and may create unexpected pointers to invalid memory locations. + +
Rule Severity Likelihood Remediation Cost Priority Level
INT36-C Low Probable High P2 L3
+ + +## Automated Detection + +
Tool Version Checker Description
Astrée 22.04 pointer-integral-cast pointer-integral-cast-implicit function-pointer-integer-cast function-pointer-integer-cast-implicit Fully checked
Axivion Bauhaus Suite 7.2.0 CertC-INT36 Fully implemented
Clang 3.9 -Wint-to-pointer-cast , -Wint-conversion Can detect some instances of this rule, but does not detect all
CodeSonar 7.2p0 LANG.CAST.PC.CONST2PTRLANG.CAST.PC.INT Conversion: integer constant to pointer Conversion: pointer/integer
Compass/ROSE
Coverity 2017.07 PW.POINTER_CONVERSION_LOSES_BITS Fully implemented
Helix QAC 2022.4 C0303, C0305, C0306, C0309, C0324, C0326, C0360, C0361, C0362 C++3040, C++3041, C++3042, C++3043, C++3044, C++3045, C++3046, C++3047, C++3048
Klocwork 2022.4 MISRA.CAST.OBJ_PTR_TO_INT.2012
LDRA tool suite 9.7.1 439 S, 440 S Fully implemented
Parasoft C/C++test 2022.2 CERT_C-INT36-b A conversion should not be performed between a pointer to object type and an integer type other than 'uintptr_t' or 'intptr_t'
PC-lint Plus 1.4 4287 Partially supported: reports casts from pointer types to smaller integer types which lose information
Polyspace Bug Finder R2022b CERT C: Rule INT36-C Checks for unsafe conversion between pointer and integer (rule partially covered)
PRQA QA-C 9.7 0303, 0305, 0306, 0309, 0324, 0326, 0360, 0361, 0362 Partially implemented
PRQA QA-C++ 4.4 3040, 3041, 3042, 3043, 3044, 3045, 3046, 3047, 3048
PVS-Studio 7.23 V527 , V528 , V542 , V566 , V601 , V647 , V1091
RuleChecker 22.04 pointer-integral-cast pointer-integral-cast-implicit function-pointer-integer-cast function-pointer-integer-cast-implicit Fully checked
SonarQube C/C++ Plugin 3.11 S1767 Partially implemented
+ + +## Related Vulnerabilities + +Search for [vulnerabilities](https://wiki.sei.cmu.edu/confluence/display/c/BB.+Definitions#BB.Definitions-vulnerability) resulting from the violation of this rule on the [CERT website](https://www.kb.cert.org/vulnotes/bymetric?searchview&query=FIELD+KEYWORDS+contains+INT36-C). + +## Related Guidelines + +[Key here](https://wiki.sei.cmu.edu/confluence/display/c/How+this+Coding+Standard+is+Organized#HowthisCodingStandardisOrganized-RelatedGuidelines) (explains table format and definitions) + +
Taxonomy Taxonomy item Relationship
CERT C INT11-CPP. Take care when converting from pointer to integer or integer to pointer Prior to 2018-01-12: CERT: Unspecified Relationship
ISO/IEC TR 24772:2013 Pointer Casting and Pointer Type Changes \[HFC\] Prior to 2018-01-12: CERT: Unspecified Relationship
ISO/IEC TS 17961:2013 Converting a pointer to integer or integer to pointer \[intptrconv\] Prior to 2018-01-12: CERT: Unspecified Relationship
CWE 2.11 CWE-587 , Assignment of a Fixed Address to a Pointer 2017-07-07: CERT: Partial overlap
CWE 2.11 CWE-704 2017-06-14: CERT: Rule subset of CWE
CWE 2.11 CWE-758 2017-07-07: CERT: Rule subset of CWE
CWE 3.1 CWE-119 , Improper Restriction of Operations within the Bounds of a Memory Buffer 2018-10-19:CERT:None
CWE 3.1 CWE-466 , Return of Pointer Value Outside of Expected Range 2018-10-19:CERT:None
+ + +## CERT-CWE Mapping Notes + +[Key here](https://wiki.sei.cmu.edu/confluence/pages/viewpage.action?pageId=87152408#HowthisCodingStandardisOrganized-CERT-CWEMappingNotes) for mapping notes + +**CWE-758 and INT36-C** + +Independent( INT34-C, INT36-C, MEM30-C, MSC37-C, FLP32-C, EXP33-C, EXP30-C, ERR34-C, ARR32-C) + +CWE-758 = Union( INT36-C, list) where list = + +* Undefined behavior that results from anything other than integer <-> pointer conversion +**CWE-704 and INT36-C** + +CWE-704 = Union( INT36-C, list) where list = + +* Incorrect (?) typecast that is not between integers and pointers +**CWE-587 and INT36-C** + +Intersection( CWE-587, INT36-C) = + +* Setting a pointer to an integer value that is ill-defined (trap representation, improperly aligned, mis-typed, etc) +CWE-587 – INT36-C = +* Setting a pointer to a valid integer value (eg points to an object of the correct t ype) +INT36-C – CWE-587 = +* Illegal pointer-to-integer conversion +Intersection(INT36-C,CWE-466) = ∅ + +Intersection(INT36-C,CWE-466) = ∅ + +An example explaining the above two equations follows: + +`static char x[3];` + +`char* foo() {` + +` int x_int = (int) x; // x_int = 999 eg` + +` return x_int + 5; // returns 1004 , violates CWE 466` + +`}` + +`...` + +`int y_int = foo(); // violates CWE-466` + +`char* y = (char*) y_int; // // well-defined but y may be invalid, violates INT36-C` + +`char c = *y; // indeterminate value, out-of-bounds read, violates CWE-119` + +## Bibliography + +
\[ ISO/IEC 9899:2011 \] 6.3.2.3, "Pointers"
-** REPLACE THIS BY RUNNING THE SCRIPT `scripts/help/cert-help-extraction.py` ** ## Implementation notes From c2ced98b7495d1e5d38e7e0eb20d6b793de38b82 Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Fri, 3 Mar 2023 16:22:55 -0800 Subject: [PATCH 26/53] Update select clause for 7-4 --- .../src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql b/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql index e1a8c39fde..f7f859e0a7 100644 --- a/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql +++ b/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql @@ -72,4 +72,4 @@ where or returningNonConstCharVar(elem, message) ) -select message +select elem, message From f40672939392ffa557d564a460d34285aba2a56c Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Mon, 6 Mar 2023 10:08:31 -0800 Subject: [PATCH 27/53] Add an additional check to INT36-C Additional clause to ensure `int` has different size from `PointerType` to avoid FP on some platforms --- .../INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql b/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql index 6df573885b..dff99d1889 100644 --- a/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql +++ b/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql @@ -95,5 +95,6 @@ where assigningPointerValueToInteger(elem, message) or castingPointerToInteger(elem, message) - ) + ) and + forall(IntType intType, PointerType ptrType | intType.getSize() != ptrType.getSize()) select elem, message From 2c1ea8270a307dd2f476b6f11c2bfe54ff8afde2 Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Mon, 6 Mar 2023 10:19:27 -0800 Subject: [PATCH 28/53] Minor comment stuff --- .../INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql | 1 + 1 file changed, 1 insertion(+) diff --git a/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql b/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql index dff99d1889..2971c07770 100644 --- a/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql +++ b/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql @@ -96,5 +96,6 @@ where or castingPointerToInteger(elem, message) ) and + /* Ensure that `int` has different size than that of pointers */ forall(IntType intType, PointerType ptrType | intType.getSize() != ptrType.getSize()) select elem, message From 1408a855973ceae07d1c4601a13d5dcaa37ae9ad Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Mon, 6 Mar 2023 14:01:20 -0800 Subject: [PATCH 29/53] Address minor things for Actions --- .../DIR-4-6/TypedefsThatIndicateSizeAndSig.ql | 18 ----- .../cpp/exclusions/c/Types.qll | 70 +++++++++---------- rule_packages/c/Types.json | 6 +- 3 files changed, 38 insertions(+), 56 deletions(-) delete mode 100644 c/misra/src/rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.ql diff --git a/c/misra/src/rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.ql b/c/misra/src/rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.ql deleted file mode 100644 index 32f6f10a9a..0000000000 --- a/c/misra/src/rules/DIR-4-6/TypedefsThatIndicateSizeAndSig.ql +++ /dev/null @@ -1,18 +0,0 @@ -/** - * @id c/misra/typedefs-that-indicate-size-and-sig - * @name DIR-4-6: typedefs that indicate size and signedness should be used in place of the basic numerical types - * @description TODO. - * @kind problem - * @precision high - * @problem.severity error - * @tags external/misra/id/dir-4-6 - * external/misra/obligation/advisory - */ - -import cpp -import codingstandards.c.misra - -from -where - not isExcluded(x, TypesPackage::typedefsThatIndicateSizeAndSigQuery()) and -select diff --git a/cpp/common/src/codingstandards/cpp/exclusions/c/Types.qll b/cpp/common/src/codingstandards/cpp/exclusions/c/Types.qll index f50d30d5f0..970e07f6c9 100644 --- a/cpp/common/src/codingstandards/cpp/exclusions/c/Types.qll +++ b/cpp/common/src/codingstandards/cpp/exclusions/c/Types.qll @@ -4,92 +4,92 @@ import RuleMetadata import codingstandards.cpp.exclusions.RuleMetadata newtype TypesQuery = -TExprShiftedbyNegativeOrGreaterPrecisionOperandQuery() or -TConvertingAPointerToIntegerOrIntegerToPointerQuery() or -TPlainNumericalTypeUsedOverExplicitTypedefQuery() or -TSizeofOperatorUsedOnArrayTypeParamQuery() or -TStringLiteralAssignedToNonConstCharQuery() + TExprShiftedbyNegativeOrGreaterPrecisionOperandQuery() or + TConvertingAPointerToIntegerOrIntegerToPointerQuery() or + TPlainNumericalTypeUsedOverExplicitTypedefQuery() or + TSizeofOperatorUsedOnArrayTypeParamQuery() or + TStringLiteralAssignedToNonConstCharQuery() predicate isTypesQueryMetadata(Query query, string queryId, string ruleId, string category) { query = // `Query` instance for the `exprShiftedbyNegativeOrGreaterPrecisionOperand` query - TypesPackage::exprShiftedbyNegativeOrGreaterPrecisionOperandQuery() and + TypesPackage::exprShiftedbyNegativeOrGreaterPrecisionOperandQuery() and queryId = // `@id` for the `exprShiftedbyNegativeOrGreaterPrecisionOperand` query - "c/cert/expr-shiftedby-negative-or-greater-precision-operand" and + "c/cert/expr-shiftedby-negative-or-greater-precision-operand" and ruleId = "INT34-C" and category = "rule" or query = // `Query` instance for the `convertingAPointerToIntegerOrIntegerToPointer` query - TypesPackage::convertingAPointerToIntegerOrIntegerToPointerQuery() and + TypesPackage::convertingAPointerToIntegerOrIntegerToPointerQuery() and queryId = // `@id` for the `convertingAPointerToIntegerOrIntegerToPointer` query - "c/cert/converting-a-pointer-to-integer-or-integer-to-pointer" and + "c/cert/converting-a-pointer-to-integer-or-integer-to-pointer" and ruleId = "INT36-C" and category = "rule" or query = // `Query` instance for the `plainNumericalTypeUsedOverExplicitTypedef` query - TypesPackage::plainNumericalTypeUsedOverExplicitTypedefQuery() and + TypesPackage::plainNumericalTypeUsedOverExplicitTypedefQuery() and queryId = // `@id` for the `plainNumericalTypeUsedOverExplicitTypedef` query - "c/misra/plain-numerical-type-used-over-explicit-typedef" and + "c/misra/plain-numerical-type-used-over-explicit-typedef" and ruleId = "DIR-4-6" and category = "advisory" or query = // `Query` instance for the `sizeofOperatorUsedOnArrayTypeParam` query - TypesPackage::sizeofOperatorUsedOnArrayTypeParamQuery() and + TypesPackage::sizeofOperatorUsedOnArrayTypeParamQuery() and queryId = // `@id` for the `sizeofOperatorUsedOnArrayTypeParam` query - "c/misra/sizeof-operator-used-on-array-type-param" and + "c/misra/sizeof-operator-used-on-array-type-param" and ruleId = "RULE-12-5" and category = "mandatory" or query = // `Query` instance for the `stringLiteralAssignedToNonConstChar` query - TypesPackage::stringLiteralAssignedToNonConstCharQuery() and + TypesPackage::stringLiteralAssignedToNonConstCharQuery() and queryId = // `@id` for the `stringLiteralAssignedToNonConstChar` query - "c/misra/string-literal-assigned-to-non-const-char" and + "c/misra/string-literal-assigned-to-non-const-char" and ruleId = "RULE-7-4" and category = "required" } module TypesPackage { -Query exprShiftedbyNegativeOrGreaterPrecisionOperandQuery() { + Query exprShiftedbyNegativeOrGreaterPrecisionOperandQuery() { //autogenerate `Query` type - result = + result = // `Query` type for `exprShiftedbyNegativeOrGreaterPrecisionOperand` query - TQueryC(TTypesPackageQuery(TExprShiftedbyNegativeOrGreaterPrecisionOperandQuery())) -} + TQueryC(TTypesPackageQuery(TExprShiftedbyNegativeOrGreaterPrecisionOperandQuery())) + } -Query convertingAPointerToIntegerOrIntegerToPointerQuery() { + Query convertingAPointerToIntegerOrIntegerToPointerQuery() { //autogenerate `Query` type - result = + result = // `Query` type for `convertingAPointerToIntegerOrIntegerToPointer` query - TQueryC(TTypesPackageQuery(TConvertingAPointerToIntegerOrIntegerToPointerQuery())) -} + TQueryC(TTypesPackageQuery(TConvertingAPointerToIntegerOrIntegerToPointerQuery())) + } -Query plainNumericalTypeUsedOverExplicitTypedefQuery() { + Query plainNumericalTypeUsedOverExplicitTypedefQuery() { //autogenerate `Query` type - result = + result = // `Query` type for `plainNumericalTypeUsedOverExplicitTypedef` query - TQueryC(TTypesPackageQuery(TPlainNumericalTypeUsedOverExplicitTypedefQuery())) -} + TQueryC(TTypesPackageQuery(TPlainNumericalTypeUsedOverExplicitTypedefQuery())) + } -Query sizeofOperatorUsedOnArrayTypeParamQuery() { + Query sizeofOperatorUsedOnArrayTypeParamQuery() { //autogenerate `Query` type - result = + result = // `Query` type for `sizeofOperatorUsedOnArrayTypeParam` query - TQueryC(TTypesPackageQuery(TSizeofOperatorUsedOnArrayTypeParamQuery())) -} + TQueryC(TTypesPackageQuery(TSizeofOperatorUsedOnArrayTypeParamQuery())) + } -Query stringLiteralAssignedToNonConstCharQuery() { + Query stringLiteralAssignedToNonConstCharQuery() { //autogenerate `Query` type - result = + result = // `Query` type for `stringLiteralAssignedToNonConstChar` query - TQueryC(TTypesPackageQuery(TStringLiteralAssignedToNonConstCharQuery())) -} + TQueryC(TTypesPackageQuery(TStringLiteralAssignedToNonConstCharQuery())) + } } diff --git a/rule_packages/c/Types.json b/rule_packages/c/Types.json index 0324a637a3..aa9e8d3fef 100644 --- a/rule_packages/c/Types.json +++ b/rule_packages/c/Types.json @@ -367,7 +367,7 @@ { "description": "Using sizeof operator on an array type function parameter leads to unintended results.", "kind": "problem", - "name": "The sizeof operator should not be used on an array type function parameter.", + "name": "The sizeof operator should not be used on an array type function parameter", "precision": "very-high", "severity": "error", "short_name": "SizeofOperatorUsedOnArrayTypeParam", @@ -469,7 +469,7 @@ { "description": "Assigning string literal to a variable with type other than a pointer to const char and modifying it causes undefined behavior .", "kind": "problem", - "name": "A string literal shall only be assigned to a pointer to const char.", + "name": "A string literal shall only be assigned to a pointer to const char", "precision": "very-high", "severity": "error", "short_name": "StringLiteralAssignedToNonConstChar", @@ -479,4 +479,4 @@ "title": "A string literal shall not be assigned to an object unless the object's type is 'pointer to const-qualified char'" } } -} +} \ No newline at end of file From cb45556f874dddc4bf5a4c4b7d62f739cb7524e9 Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Mon, 6 Mar 2023 14:04:34 -0800 Subject: [PATCH 30/53] Update queries and .expected for DIR-4-6 --- ...ainNumericalTypeUsedOverExplicitTypedef.ql | 31 +++++++++++-------- ...ericalTypeUsedOverExplicitTypedef.expected | 20 +++++++++++- 2 files changed, 37 insertions(+), 14 deletions(-) diff --git a/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql b/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql index 4d36edb35a..31cbe66a4a 100644 --- a/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql +++ b/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql @@ -13,9 +13,7 @@ import cpp import codingstandards.c.misra -abstract class ForbiddenType extends Type { } - -class BuiltinNumericType extends ForbiddenType { +class BuiltinNumericType extends BuiltInType { BuiltinNumericType() { /* Exclude the plain char because it does not count as a numeric type */ this.(CharType).isExplicitlySigned() @@ -38,15 +36,22 @@ class BuiltinNumericType extends ForbiddenType { } } -class ForbiddenTypedefType extends ForbiddenType, TypedefType { - ForbiddenTypedefType() { - this.(TypedefType).getBaseType() instanceof BuiltinNumericType and - not this.getName().regexpMatch("u?(int|float)(4|8|16|32|64|128)_t") - } +predicate forbiddenBuiltinNumericUsedInDecl(Variable var, string message) { + var.getType() instanceof BuiltinNumericType and + message = "The type " + var.getType() + " is not a fixed-width numeric type." +} + +predicate forbiddenTypedef(TypedefType typedef, string message) { + typedef.getBaseType() instanceof BuiltinNumericType and + not typedef.getName().regexpMatch("u?(int|float)(4|8|16|32|64|128)_t") and + message = "The type " + typedef.getName() + " is not an alias to a fixed-width numeric type." } -/* TODO: BuiltinNumericType not being flagged */ -from ForbiddenType forbiddenType -where not isExcluded(forbiddenType, TypesPackage::plainNumericalTypeUsedOverExplicitTypedefQuery()) -select forbiddenType, - "The type " + forbiddenType + " is not a fixed-width numeric type nor an alias to one." +from Element elem, string message +where + not isExcluded(elem, TypesPackage::plainNumericalTypeUsedOverExplicitTypedefQuery()) and + ( + forbiddenBuiltinNumericUsedInDecl(elem, message) or + forbiddenTypedef(elem, message) + ) +select elem, message diff --git a/c/misra/test/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.expected b/c/misra/test/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.expected index 2ec1a0ac6c..7aa7ba28ad 100644 --- a/c/misra/test/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.expected +++ b/c/misra/test/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.expected @@ -1 +1,19 @@ -No expected results have yet been specified \ No newline at end of file +| test.c:27:5:27:26 | _astronomical_number_t | The type _astronomical_number_t is not an alias to a fixed-width numeric type. | +| test.c:30:10:30:13 | argc | The type int is not a fixed-width numeric type. | +| test.c:34:15:34:16 | c2 | The type signed char is not a fixed-width numeric type. | +| test.c:35:17:35:18 | c3 | The type unsigned char is not a fixed-width numeric type. | +| test.c:38:9:38:10 | s1 | The type short is not a fixed-width numeric type. | +| test.c:39:16:39:17 | s2 | The type signed short is not a fixed-width numeric type. | +| test.c:40:18:40:19 | s3 | The type unsigned short is not a fixed-width numeric type. | +| test.c:43:7:43:8 | i1 | The type int is not a fixed-width numeric type. | +| test.c:44:14:44:15 | i2 | The type signed int is not a fixed-width numeric type. | +| test.c:45:16:45:17 | i3 | The type unsigned int is not a fixed-width numeric type. | +| test.c:48:8:48:9 | l1 | The type long is not a fixed-width numeric type. | +| test.c:49:15:49:16 | l2 | The type signed long is not a fixed-width numeric type. | +| test.c:50:17:50:18 | l3 | The type unsigned long is not a fixed-width numeric type. | +| test.c:53:13:53:15 | ll1 | The type long long is not a fixed-width numeric type. | +| test.c:54:20:54:22 | ll2 | The type signed long long is not a fixed-width numeric type. | +| test.c:55:22:55:24 | ll3 | The type unsigned long long is not a fixed-width numeric type. | +| test.c:58:9:58:10 | f1 | The type float is not a fixed-width numeric type. | +| test.c:61:10:61:11 | d1 | The type double is not a fixed-width numeric type. | +| test.c:64:15:64:17 | ld1 | The type long double is not a fixed-width numeric type. | From f6488aad49808fbe634a029600a18598015ee389 Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Mon, 6 Mar 2023 14:14:33 -0800 Subject: [PATCH 31/53] Format query metadata --- .../src/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.ql | 2 +- .../src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c/misra/src/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.ql b/c/misra/src/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.ql index ad1dba6df4..2215c819fd 100644 --- a/c/misra/src/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.ql +++ b/c/misra/src/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.ql @@ -1,6 +1,6 @@ /** * @id c/misra/sizeof-operator-used-on-array-type-param - * @name RULE-12-5: The sizeof operator should not be used on an array type function parameter. + * @name RULE-12-5: The sizeof operator should not be used on an array type function parameter * @description Using sizeof operator on an array type function parameter leads to unintended * results. * @kind problem diff --git a/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql b/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql index f7f859e0a7..bd9a72943f 100644 --- a/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql +++ b/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql @@ -1,6 +1,6 @@ /** * @id c/misra/string-literal-assigned-to-non-const-char - * @name RULE-7-4: A string literal shall only be assigned to a pointer to const char. + * @name RULE-7-4: A string literal shall only be assigned to a pointer to const char * @description Assigning string literal to a variable with type other than a pointer to const char * and modifying it causes undefined behavior . * @kind problem From aeb9b65f27290e51514f2ec994f09e6aba969364 Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Mon, 6 Mar 2023 15:04:45 -0800 Subject: [PATCH 32/53] Factor out shared clauses to common --- ...ainNumericalTypeUsedOverExplicitTypedef.ql | 18 ++++++-------- ...ericalTypeUsedOverExplicitTypedef.expected | 1 - .../A3-9-1/VariableWidthIntegerTypesUsed.ql | 24 ++++--------------- .../cpp/BuiltInNumericTypes.qll | 22 +++++++++++++++++ 4 files changed, 33 insertions(+), 32 deletions(-) create mode 100644 cpp/common/src/codingstandards/cpp/BuiltInNumericTypes.qll diff --git a/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql b/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql index 31cbe66a4a..29dd1c16d4 100644 --- a/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql +++ b/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql @@ -12,21 +12,16 @@ import cpp import codingstandards.c.misra +import codingstandards.cpp.BuiltInNumericTypes -class BuiltinNumericType extends BuiltInType { - BuiltinNumericType() { +class BuiltInNumericType extends BuiltInType { + BuiltInNumericType() { /* Exclude the plain char because it does not count as a numeric type */ this.(CharType).isExplicitlySigned() or this.(CharType).isExplicitlyUnsigned() or - this instanceof ShortType - or - this instanceof IntType - or - this instanceof LongType - or - this instanceof LongLongType + this instanceof BuiltInIntegerType or this instanceof FloatType or @@ -37,12 +32,13 @@ class BuiltinNumericType extends BuiltInType { } predicate forbiddenBuiltinNumericUsedInDecl(Variable var, string message) { - var.getType() instanceof BuiltinNumericType and + var.getType() instanceof BuiltInNumericType and + not var instanceof ExcludedVariable and message = "The type " + var.getType() + " is not a fixed-width numeric type." } predicate forbiddenTypedef(TypedefType typedef, string message) { - typedef.getBaseType() instanceof BuiltinNumericType and + typedef.getBaseType() instanceof BuiltInNumericType and not typedef.getName().regexpMatch("u?(int|float)(4|8|16|32|64|128)_t") and message = "The type " + typedef.getName() + " is not an alias to a fixed-width numeric type." } diff --git a/c/misra/test/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.expected b/c/misra/test/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.expected index 7aa7ba28ad..49865c8824 100644 --- a/c/misra/test/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.expected +++ b/c/misra/test/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.expected @@ -1,5 +1,4 @@ | test.c:27:5:27:26 | _astronomical_number_t | The type _astronomical_number_t is not an alias to a fixed-width numeric type. | -| test.c:30:10:30:13 | argc | The type int is not a fixed-width numeric type. | | test.c:34:15:34:16 | c2 | The type signed char is not a fixed-width numeric type. | | test.c:35:17:35:18 | c3 | The type unsigned char is not a fixed-width numeric type. | | test.c:38:9:38:10 | s1 | The type short is not a fixed-width numeric type. | diff --git a/cpp/autosar/src/rules/A3-9-1/VariableWidthIntegerTypesUsed.ql b/cpp/autosar/src/rules/A3-9-1/VariableWidthIntegerTypesUsed.ql index 46376be1af..699b79ae61 100644 --- a/cpp/autosar/src/rules/A3-9-1/VariableWidthIntegerTypesUsed.ql +++ b/cpp/autosar/src/rules/A3-9-1/VariableWidthIntegerTypesUsed.ql @@ -18,32 +18,16 @@ import cpp import codingstandards.cpp.autosar import codingstandards.cpp.EncapsulatingFunctions - -/** - * any `Parameter` in a main function like: - * int main(int argc, char *argv[]) - */ -class ExcludedVariable extends Parameter { - ExcludedVariable() { getFunction() instanceof MainFunction } -} +import codingstandards.cpp.BuiltInNumericTypes from Variable v where not isExcluded(v, DeclarationsPackage::variableWidthIntegerTypesUsedQuery()) and ( - v.getType() instanceof PlainCharType - or - v.getType() instanceof UnsignedCharType - or + v.getType() instanceof BuiltInIntegerType or + v.getType() instanceof PlainCharType or + v.getType() instanceof UnsignedCharType or v.getType() instanceof SignedCharType - or - v.getType() instanceof ShortType - or - v.getType() instanceof IntType - or - v.getType() instanceof LongType - or - v.getType() instanceof LongLongType ) and not v instanceof ExcludedVariable select v, "Variable '" + v.getName() + "' has variable-width type." diff --git a/cpp/common/src/codingstandards/cpp/BuiltInNumericTypes.qll b/cpp/common/src/codingstandards/cpp/BuiltInNumericTypes.qll new file mode 100644 index 0000000000..b145428a57 --- /dev/null +++ b/cpp/common/src/codingstandards/cpp/BuiltInNumericTypes.qll @@ -0,0 +1,22 @@ +import cpp +import codingstandards.cpp.EncapsulatingFunctions + +class BuiltInIntegerType extends BuiltInType { + BuiltInIntegerType() { + this instanceof ShortType + or + this instanceof IntType + or + this instanceof LongType + or + this instanceof LongLongType + } +} + +/** + * any `Parameter` in a main function like: + * int main(int argc, char *argv[]) + */ +class ExcludedVariable extends Parameter { + ExcludedVariable() { getFunction() instanceof MainFunction } +} From 0f532e3c589e243b46d7ccd786d278fca0ba2431 Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Mon, 6 Mar 2023 15:16:57 -0800 Subject: [PATCH 33/53] Update .expected for 7-4 --- .../RULE-7-4/StringLiteralAssignedToNonConstChar.expected | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.expected b/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.expected index 379a5659fd..235697faa6 100644 --- a/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.expected +++ b/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.expected @@ -1,4 +1,4 @@ -| char* function sample3 is returning a string literal. | -| char* parameter of sample4 is passed a string literal. | -| char* variable s3 is assigned a string literal. | -| char* variable s3 is declared with a string literal. | +| test.c:9:9:9:10 | s3 | char* variable s3 is declared with a string literal. | +| test.c:11:3:12:15 | ... = ... | char* variable s3 is assigned a string literal. | +| test.c:26:5:26:21 | return ... | char* function sample3 is returning a string literal. | +| test.c:38:3:38:9 | call to sample4 | char* parameter of sample4 is passed a string literal. | From 7617acc5f40d830a24e753aef37dc1d7c4b70a5b Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Tue, 21 Mar 2023 14:50:25 -0700 Subject: [PATCH 34/53] Reinforce 7-4 to consider wchar_t --- .../StringLiteralAssignedToNonConstChar.ql | 59 ++++++++++++++----- ...ringLiteralAssignedToNonConstChar.expected | 12 ++-- c/misra/test/rules/RULE-7-4/test.c | 44 +++++++++++++- 3 files changed, 95 insertions(+), 20 deletions(-) diff --git a/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql b/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql index bd9a72943f..311177e4b7 100644 --- a/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql +++ b/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql @@ -13,9 +13,32 @@ import cpp import codingstandards.c.misra +/** Pointer to Wide character type, i.e. `wchar_t*`. */ +class WideCharPointerType extends PointerType { + WideCharPointerType() { this.getBaseType() instanceof Wchar_t } + + override string getAPrimaryQlClass() { result = "WideCharPointerType" } +} + +class GenericCharPointerType extends PointerType { + GenericCharPointerType() { + /* This type resolves to wchar_t* (which is in turn a typedef depending on its implementation) */ + this.resolveTypedefs*() instanceof WideCharPointerType + or + /* This type eventually resolves to char* */ + this.resolveTypedefs*() instanceof CharPointerType + } + + predicate isWideCharPointerType() { this.resolveTypedefs*() instanceof WideCharPointerType } + + override string toString() { + if this.isWideCharPointerType() then result = "wchar_t*" else result = "char*" + } +} + class NonConstCharStarType extends Type { NonConstCharStarType() { - this instanceof CharPointerType and + this instanceof GenericCharPointerType and not this.isDeeplyConstBelow() } } @@ -24,40 +47,48 @@ class NonConstCharStarType extends Type { predicate declaringNonConstCharVar(Variable decl, string message) { not decl instanceof Parameter and // exclude parameters /* It should be declaring a char* type variable */ - decl.getUnspecifiedType() instanceof CharPointerType and - not decl.getUnderlyingType().isDeeplyConstBelow() and - /* But it's declared to hold a string literal. */ + decl.getType() instanceof GenericCharPointerType and + not decl.getType().isDeeplyConstBelow() and + /* But it's declared to hold a string literal. */ decl.getInitializer().getExpr() instanceof StringLiteral and - message = "char* variable " + decl + " is declared with a string literal." + message = + decl.getType().(GenericCharPointerType) + " variable " + decl + + " is declared with a string literal." } /* String literal being assigned to a non-const-char* variable */ predicate assignmentToNonConstCharVar(Assignment assign, string message) { /* The variable being assigned is char* */ - assign.getLValue().getUnderlyingType() instanceof NonConstCharStarType and + assign.getLValue().getType() instanceof NonConstCharStarType and /* But the rvalue is a string literal */ - exists(Expr rvalue | rvalue = assign.getRValue() | rvalue instanceof StringLiteral) and - message = "char* variable " + assign.getLValue() + " is assigned a string literal. " + assign.getRValue() instanceof StringLiteral and + message = + assign.getLValue().getType().(GenericCharPointerType) + " variable " + assign.getLValue() + + " is assigned a string literal. " } /* String literal being passed to a non-const-char* parameter */ predicate assignmentToNonConstCharParam(FunctionCall call, string message) { exists(int index | /* Param at index is a char* */ - call.getTarget().getParameter(index).getUnderlyingType() instanceof NonConstCharStarType and + call.getTarget().getParameter(index).getType() instanceof NonConstCharStarType and /* But a string literal is passed */ - call.getArgument(index) instanceof StringLiteral - ) and - message = "char* parameter of " + call.getTarget() + " is passed a string literal." + call.getArgument(index) instanceof StringLiteral and + message = + call.getTarget().getParameter(index).getType().(GenericCharPointerType) + " parameter of " + + call.getTarget() + " is passed a string literal." + ) } /* String literal being returned by a non-const-char* function */ predicate returningNonConstCharVar(ReturnStmt return, string message) { /* The function is declared to return a char* */ - return.getEnclosingFunction().getType().resolveTypedefs() instanceof NonConstCharStarType and + return.getEnclosingFunction().getType() instanceof NonConstCharStarType and /* But in reality it returns a string literal */ return.getExpr() instanceof StringLiteral and - message = "char* function " + return.getEnclosingFunction() + " is returning a string literal." + message = + return.getEnclosingFunction().getType().(GenericCharPointerType) + " function " + + return.getEnclosingFunction() + " is returning a string literal." } from Element elem, string message diff --git a/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.expected b/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.expected index 235697faa6..8c15eaffe0 100644 --- a/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.expected +++ b/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.expected @@ -1,4 +1,8 @@ -| test.c:9:9:9:10 | s3 | char* variable s3 is declared with a string literal. | -| test.c:11:3:12:15 | ... = ... | char* variable s3 is assigned a string literal. | -| test.c:26:5:26:21 | return ... | char* function sample3 is returning a string literal. | -| test.c:38:3:38:9 | call to sample4 | char* parameter of sample4 is passed a string literal. | +| test.c:11:9:11:10 | s3 | char* variable s3 is declared with a string literal. | +| test.c:13:3:14:15 | ... = ... | char* variable s3 is assigned a string literal. | +| test.c:23:12:23:14 | ws3 | char* variable ws3 is declared with a string literal. | +| test.c:25:3:25:23 | ... = ... | char* variable ws3 is assigned a string literal. | +| test.c:50:5:50:21 | return ... | char* function sample3 is returning a string literal. | +| test.c:58:5:58:22 | return ... | char* function w_sample3 is returning a string literal. | +| test.c:69:3:69:9 | call to sample4 | char* parameter of sample4 is passed a string literal. | +| test.c:78:3:78:11 | call to w_sample4 | char* parameter of w_sample4 is passed a string literal. | diff --git a/c/misra/test/rules/RULE-7-4/test.c b/c/misra/test/rules/RULE-7-4/test.c index fe2afb9444..5aed71ffe7 100644 --- a/c/misra/test/rules/RULE-7-4/test.c +++ b/c/misra/test/rules/RULE-7-4/test.c @@ -1,6 +1,8 @@ +#include #include void sample1() { + /* Test for plain char type */ const char *s1 = "string1"; // COMPLIANT: string literal assigned to a const char* variable const register volatile char *s2 = @@ -11,8 +13,21 @@ void sample1() { s3 = "string4"; // NON_COMPLIANT: char* variable assigned a string literal // (not likely to be seen in production, since there is strcpy) + + /* Test for wide char type */ + const wchar_t *ws1 = L"wide string1"; // COMPLIANT: string literal assigned to + // a const char* variable + const register volatile wchar_t *ws2 = + L"wide string2"; // COMPLIANT: string literal assigned to a const char* + // variable, don't care about the qualifiers + wchar_t *ws3 = L"wide string3"; // NON_COMPLIANT: char* variable declared to hold + // a string literal + ws3 = L"wide string4"; // NON_COMPLIANT: char* variable assigned a string + // literal (not likely to be seen in production, since + // there is strcpy) } +/* Testing returning a plain string literal */ const char *sample2(int x) { if (x == 1) return "string5"; // COMPLIANT: can return a string literal with return type @@ -21,6 +36,15 @@ const char *sample2(int x) { return NULL; } +/* Testing returning a wide string literal */ +const wchar_t *w_sample2(int x) { + if (x == 1) + return L"string5"; // COMPLIANT: can return a string literal with return type + // being const char* being const char* + else + return NULL; +} + char *sample3(int x) { if (x == 1) return "string6"; // NON_COMPLIANT: can return a string literal with return @@ -29,14 +53,30 @@ char *sample3(int x) { return NULL; } +wchar_t *w_sample3(int x) { + if (x == 1) + return L"string6"; // NON_COMPLIANT: can return a string literal with return + // type being char* + else + return NULL; +} + void sample4(char *string) {} void sample5(const char *string) {} void call45() { - const char *literal = "string7"; sample4("string8"); // NON_COMPLIANT: can't pass string literal to char* sample5("string9"); // COMPLIANT: passing string literal to const char* } -int main() { return 0; } \ No newline at end of file +void w_sample4(wchar_t *string) {} + +void w_sample5(const wchar_t *string) {} + +void w_call45() { + w_sample4(L"string8"); // NON_COMPLIANT: can't pass string literal to char* + w_sample5(L"string9"); // COMPLIANT: passing string literal to const char* +} + +int main() { return 0; } From 3bec0e6d28af05e4ef987a456f88b58e417df85e Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Tue, 21 Mar 2023 15:10:09 -0700 Subject: [PATCH 35/53] update .expected for RULE-7-4 --- .../RULE-7-4/StringLiteralAssignedToNonConstChar.expected | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.expected b/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.expected index 8c15eaffe0..1312594e13 100644 --- a/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.expected +++ b/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.expected @@ -1,8 +1,8 @@ | test.c:11:9:11:10 | s3 | char* variable s3 is declared with a string literal. | | test.c:13:3:14:15 | ... = ... | char* variable s3 is assigned a string literal. | -| test.c:23:12:23:14 | ws3 | char* variable ws3 is declared with a string literal. | -| test.c:25:3:25:23 | ... = ... | char* variable ws3 is assigned a string literal. | +| test.c:23:12:23:14 | ws3 | wchar_t* variable ws3 is declared with a string literal. | +| test.c:25:3:25:23 | ... = ... | wchar_t* variable ws3 is assigned a string literal. | | test.c:50:5:50:21 | return ... | char* function sample3 is returning a string literal. | -| test.c:58:5:58:22 | return ... | char* function w_sample3 is returning a string literal. | +| test.c:58:5:58:22 | return ... | wchar_t* function w_sample3 is returning a string literal. | | test.c:69:3:69:9 | call to sample4 | char* parameter of sample4 is passed a string literal. | -| test.c:78:3:78:11 | call to w_sample4 | char* parameter of w_sample4 is passed a string literal. | +| test.c:78:3:78:11 | call to w_sample4 | wchar_t* parameter of w_sample4 is passed a string literal. | From 99a21b19379494607ce9ec893104f7b65926fc24 Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Wed, 22 Mar 2023 15:52:51 -0700 Subject: [PATCH 36/53] Checkpoint: INT34-C --- ...ftedbyNegativeOrGreaterPrecisionOperand.ql | 144 +- c/cert/test/rules/INT34-C/test.c | 3641 ++++++++++++++--- 2 files changed, 3226 insertions(+), 559 deletions(-) diff --git a/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql b/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql index 1eb6459628..354e651c2a 100644 --- a/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql +++ b/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql @@ -12,72 +12,134 @@ import cpp import codingstandards.c.cert +import semmle.code.cpp.rangeanalysis.SimpleRangeAnalysis +import semmle.code.cpp.controlflow.Guards /* - * Precision predicate based on a sample implementaion from + * Precision predicate based on a sample implementation from * https://wiki.sei.cmu.edu/confluence/display/c/INT35-C.+Use+correct+integer+precisions */ +/** + * A function whose name is suggestive that it counts the number of bits set. + */ +class PopCount extends Function { + PopCount() { this.getName().toLowerCase().matches("%popc%nt%") } +} + +/** + * A macro which is suggestive that it is used to determine the precision of an integer. + */ +class PrecisionMacro extends Macro { + PrecisionMacro() { this.getName().toLowerCase().matches("precision") } +} + int getPrecision(BuiltInType type) { - type.(CharType).isExplicitlyUnsigned() and result = 8 + type.(CharType).isExplicitlyUnsigned() and result = type.(CharType).getSize() * 8 or - type.(ShortType).isExplicitlyUnsigned() and result = 16 + type.(ShortType).isExplicitlyUnsigned() and result = type.(ShortType).getSize() * 8 or - type.(IntType).isExplicitlyUnsigned() and result = 32 + type.(IntType).isExplicitlyUnsigned() and result = type.(IntType).getSize() * 8 or - type.(LongType).isExplicitlyUnsigned() and result = 32 + type.(LongType).isExplicitlyUnsigned() and result = type.(LongType).getSize() * 8 or - type.(LongLongType).isExplicitlyUnsigned() and result = 64 + type.(LongLongType).isExplicitlyUnsigned() and result = type.(LongLongType).getSize() * 8 or - type instanceof CharType and not type.(CharType).isExplicitlyUnsigned() and result = 7 + type instanceof CharType and + not type.(CharType).isExplicitlyUnsigned() and + result = type.(CharType).getSize() * 8 - 1 or - type instanceof ShortType and not type.(ShortType).isExplicitlyUnsigned() and result = 15 + type instanceof ShortType and + not type.(ShortType).isExplicitlyUnsigned() and + result = type.(ShortType).getSize() * 8 - 1 or - type instanceof IntType and not type.(IntType).isExplicitlyUnsigned() and result = 31 + type instanceof IntType and + not type.(IntType).isExplicitlyUnsigned() and + result = type.(IntType).getSize() * 8 - 1 or - type instanceof LongType and not type.(LongType).isExplicitlyUnsigned() and result = 31 + type instanceof LongType and + not type.(LongType).isExplicitlyUnsigned() and + result = type.(LongType).getSize() * 8 - 1 or - type instanceof LongLongType and not type.(LongLongType).isExplicitlyUnsigned() and result = 63 + type instanceof LongLongType and + not type.(LongLongType).isExplicitlyUnsigned() and + result = type.(LongLongType).getSize() * 8 - 1 } -/* The -1 number literal. */ -class MinusNumberLiteral extends UnaryMinusExpr { - MinusNumberLiteral() { this.getOperand() instanceof Literal } +predicate isForbiddenLShiftExpr(LShiftExpr binbitop, string message) { + ( + ( + getPrecision(binbitop.getLeftOperand().getUnderlyingType()) <= + upperBound(binbitop.getRightOperand()) and + message = + "The operand " + binbitop.getLeftOperand() + " is left-shifted by an expression " + + binbitop.getRightOperand() + " which is greater than or equal to in precision." + or + lowerBound(binbitop.getRightOperand()) < 0 and + message = + "The operand " + binbitop.getLeftOperand() + " is left-shifted by a negative expression " + + binbitop.getRightOperand() + "." + ) + or + /* Check a guard condition protecting the shift statement: heuristic (not an iff query) */ + exists(GuardCondition gc, BasicBlock block, Expr precisionCall | + block = binbitop.getBasicBlock() and + ( + precisionCall.(FunctionCall).getTarget() instanceof PopCount + or + precisionCall = any(PrecisionMacro pm).getAnInvocation().getExpr() + ) + | + /* + * Shift statement is at a basic block where + * `shift_rhs < PRECISION(...)` is ensured + */ - override string toString() { result = "-" + this.getOperand().toString() } + not gc.ensuresLt(binbitop.getRightOperand(), precisionCall, 0, block, true) + ) and + message = "TODO" + ) } -class ForbiddenShiftExpr extends BinaryBitwiseOperation { - ForbiddenShiftExpr() { +predicate isForbiddenRShiftExpr(RShiftExpr binbitop, string message) { + ( ( - /* First Case: Precision mismatch between operands */ - getPrecision(this.(LShiftExpr).getLeftOperand().getUnderlyingType()) <= - getPrecision(this.(LShiftExpr).getRightOperand().getUnderlyingType()) or - getPrecision(this.(RShiftExpr).getLeftOperand().getUnderlyingType()) <= - getPrecision(this.(RShiftExpr).getRightOperand().getUnderlyingType()) or - /* Second Case: Shifting by a negative number literal */ - this.(LShiftExpr).getRightOperand() instanceof MinusNumberLiteral or - this.(RShiftExpr).getRightOperand() instanceof MinusNumberLiteral + getPrecision(binbitop.getLeftOperand().getUnderlyingType()) <= + upperBound(binbitop.getRightOperand()) and + message = + "The operand " + binbitop.getLeftOperand() + " is right-shifted by an expression " + + binbitop.getRightOperand() + " which is greater than or equal to in precision." + or + lowerBound(binbitop.getRightOperand()) < 0 and + message = + "The operand " + binbitop.getLeftOperand() + " is right-shifted by a negative expression " + + binbitop.getRightOperand() + "." ) - } + or + /* Check a guard condition protecting the shift statement: heuristic (not an iff query) */ + exists(GuardCondition gc, BasicBlock block, Expr precisionCall | + block = binbitop.getBasicBlock() and + ( + precisionCall.(FunctionCall).getTarget() instanceof PopCount + or + precisionCall = any(PrecisionMacro pm).getAnInvocation().getExpr() + ) + | + /* + * Shift statement is at a basic block where + * `shift_rhs < PRECISION(...)` is ensured + */ - /* Second Case: Shifting by a negative number literal */ - predicate hasNegativeOperand() { - this.(LShiftExpr).getRightOperand() instanceof MinusNumberLiteral or - this.(RShiftExpr).getRightOperand() instanceof MinusNumberLiteral - } + not gc.ensuresLt(binbitop.getRightOperand(), precisionCall, 0, block, true) + ) and + message = "TODO" + ) } -from ForbiddenShiftExpr badShift, string message +from BinaryBitwiseOperation badShift, string message where not isExcluded(badShift, TypesPackage::exprShiftedbyNegativeOrGreaterPrecisionOperandQuery()) and - if badShift.hasNegativeOperand() - then - message = - "The operand " + badShift.getLeftOperand() + " is shifted by a negative expression " + - badShift.getRightOperand() + "." - else - message = - "The operand " + badShift.getLeftOperand() + " is shifted by an expression " + - badShift.getRightOperand() + " which is greater than or equal to in precision." + isForbiddenLShiftExpr(badShift, message) + or + isForbiddenRShiftExpr(badShift, message) select badShift, message diff --git a/c/cert/test/rules/INT34-C/test.c b/c/cert/test/rules/INT34-C/test.c index 982d0c15b5..e72c2b44d2 100644 --- a/c/cert/test/rules/INT34-C/test.c +++ b/c/cert/test/rules/INT34-C/test.c @@ -1,527 +1,3132 @@ +#include +#include +#include + +extern size_t popcount(uintmax_t) {}; +#define PRECISION(x) popcount(x) + int main() { - unsigned char x0; - signed char x1; - char x2; - unsigned short x3; - signed short x4; - short x5; - unsigned int x6; - signed int x7; - int x8; - unsigned long x9; - signed long x10; - long x11; - unsigned long long x12; - signed long long x13; - long long x14; + unsigned char lhs0 = UCHAR_MAX; + signed char lhs1 = CHAR_MAX; + char lhs2 = CHAR_MAX; + unsigned short lhs3 = USHRT_MAX; + signed short lhs4 = SHRT_MAX; + short lhs5 = SHRT_MAX; + unsigned int lhs6 = UINT_MAX; + signed int lhs7 = INT_MAX; + int lhs8 = INT_MAX; + unsigned long lhs9 = ULONG_MAX; + signed long lhs10 = LONG_MAX; + long lhs11 = LONG_MAX; + unsigned long long lhs12 = ULLONG_MAX; + signed long long lhs13 = LLONG_MAX; + long long lhs14 = LLONG_MAX; + + unsigned long long rhs0 = 8; + unsigned long long rhs1 = 7; + unsigned long long rhs2 = 7; + unsigned long long rhs3 = 16; + unsigned long long rhs4 = 15; + unsigned long long rhs5 = 15; + unsigned long long rhs6 = 32; + unsigned long long rhs7 = 31; + unsigned long long rhs8 = 31; + unsigned long long rhs9 = 32; + unsigned long long rhs10 = 31; + unsigned long long rhs11 = 31; + unsigned long long rhs12 = 64; + unsigned long long rhs13 = 63; + unsigned long long rhs14 = 63; + + /* ========== Left shifts ========== */ + + lhs0 << rhs0; // NON_COMPLIANT: lhs0's precision is not strictly greater than + // rhs0's + lhs0 << rhs1; // COMPLIANT: lhs0's precision is strictly greater than rhs1 + lhs0 << rhs2; // COMPLIANT: lhs0's precision is strictly greater than rhs2 + lhs0 << rhs3; // NON_COMPLIANT: lhs0's precision is not strictly greater than + // rhs3's + lhs0 << rhs4; // NON_COMPLIANT: lhs0's precision is not strictly greater than + // rhs4's + lhs0 << rhs5; // NON_COMPLIANT: lhs0's precision is not strictly greater than + // rhs5's + lhs0 << rhs6; // NON_COMPLIANT: lhs0's precision is not strictly greater than + // rhs6's + lhs0 << rhs7; // NON_COMPLIANT: lhs0's precision is not strictly greater than + // rhs7's + lhs0 << rhs8; // NON_COMPLIANT: lhs0's precision is not strictly greater than + // rhs8's + lhs0 << rhs9; // NON_COMPLIANT: lhs0's precision is not strictly greater than + // rhs9's + lhs0 << rhs10; // NON_COMPLIANT: lhs0's precision is not strictly greater than + // rhs10's + lhs0 << rhs11; // NON_COMPLIANT: lhs0's precision is not strictly greater than + // rhs11's + lhs0 << rhs12; // NON_COMPLIANT: lhs0's precision is not strictly greater than + // rhs12's + lhs0 << rhs13; // NON_COMPLIANT: lhs0's precision is not strictly greater than + // rhs13's + lhs0 << rhs14; // NON_COMPLIANT: lhs0's precision is not strictly greater than + // rhs14's + lhs1 << rhs0; // NON_COMPLIANT: lhs1's precision is not strictly greater than + // rhs0's + lhs1 << rhs1; // NON_COMPLIANT: lhs1's precision is not strictly greater than + // rhs1's + lhs1 << rhs2; // NON_COMPLIANT: lhs1's precision is not strictly greater than + // rhs2's + lhs1 << rhs3; // NON_COMPLIANT: lhs1's precision is not strictly greater than + // rhs3's + lhs1 << rhs4; // NON_COMPLIANT: lhs1's precision is not strictly greater than + // rhs4's + lhs1 << rhs5; // NON_COMPLIANT: lhs1's precision is not strictly greater than + // rhs5's + lhs1 << rhs6; // NON_COMPLIANT: lhs1's precision is not strictly greater than + // rhs6's + lhs1 << rhs7; // NON_COMPLIANT: lhs1's precision is not strictly greater than + // rhs7's + lhs1 << rhs8; // NON_COMPLIANT: lhs1's precision is not strictly greater than + // rhs8's + lhs1 << rhs9; // NON_COMPLIANT: lhs1's precision is not strictly greater than + // rhs9's + lhs1 << rhs10; // NON_COMPLIANT: lhs1's precision is not strictly greater than + // rhs10's + lhs1 << rhs11; // NON_COMPLIANT: lhs1's precision is not strictly greater than + // rhs11's + lhs1 << rhs12; // NON_COMPLIANT: lhs1's precision is not strictly greater than + // rhs12's + lhs1 << rhs13; // NON_COMPLIANT: lhs1's precision is not strictly greater than + // rhs13's + lhs1 << rhs14; // NON_COMPLIANT: lhs1's precision is not strictly greater than + // rhs14's + lhs2 << rhs0; // NON_COMPLIANT: lhs2's precision is not strictly greater than + // rhs0's + lhs2 << rhs1; // NON_COMPLIANT: lhs2's precision is not strictly greater than + // rhs1's + lhs2 << rhs2; // NON_COMPLIANT: lhs2's precision is not strictly greater than + // rhs2's + lhs2 << rhs3; // NON_COMPLIANT: lhs2's precision is not strictly greater than + // rhs3's + lhs2 << rhs4; // NON_COMPLIANT: lhs2's precision is not strictly greater than + // rhs4's + lhs2 << rhs5; // NON_COMPLIANT: lhs2's precision is not strictly greater than + // rhs5's + lhs2 << rhs6; // NON_COMPLIANT: lhs2's precision is not strictly greater than + // rhs6's + lhs2 << rhs7; // NON_COMPLIANT: lhs2's precision is not strictly greater than + // rhs7's + lhs2 << rhs8; // NON_COMPLIANT: lhs2's precision is not strictly greater than + // rhs8's + lhs2 << rhs9; // NON_COMPLIANT: lhs2's precision is not strictly greater than + // rhs9's + lhs2 << rhs10; // NON_COMPLIANT: lhs2's precision is not strictly greater than + // rhs10's + lhs2 << rhs11; // NON_COMPLIANT: lhs2's precision is not strictly greater than + // rhs11's + lhs2 << rhs12; // NON_COMPLIANT: lhs2's precision is not strictly greater than + // rhs12's + lhs2 << rhs13; // NON_COMPLIANT: lhs2's precision is not strictly greater than + // rhs13's + lhs2 << rhs14; // NON_COMPLIANT: lhs2's precision is not strictly greater than + // rhs14's + lhs3 << rhs0; // COMPLIANT: lhs3's precision is strictly greater than rhs0 + lhs3 << rhs1; // COMPLIANT: lhs3's precision is strictly greater than rhs1 + lhs3 << rhs2; // COMPLIANT: lhs3's precision is strictly greater than rhs2 + lhs3 << rhs3; // NON_COMPLIANT: lhs3's precision is not strictly greater than + // rhs3's + lhs3 << rhs4; // COMPLIANT: lhs3's precision is strictly greater than rhs4 + lhs3 << rhs5; // COMPLIANT: lhs3's precision is strictly greater than rhs5 + lhs3 << rhs6; // NON_COMPLIANT: lhs3's precision is not strictly greater than + // rhs6's + lhs3 << rhs7; // NON_COMPLIANT: lhs3's precision is not strictly greater than + // rhs7's + lhs3 << rhs8; // NON_COMPLIANT: lhs3's precision is not strictly greater than + // rhs8's + lhs3 << rhs9; // NON_COMPLIANT: lhs3's precision is not strictly greater than + // rhs9's + lhs3 << rhs10; // NON_COMPLIANT: lhs3's precision is not strictly greater than + // rhs10's + lhs3 << rhs11; // NON_COMPLIANT: lhs3's precision is not strictly greater than + // rhs11's + lhs3 << rhs12; // NON_COMPLIANT: lhs3's precision is not strictly greater than + // rhs12's + lhs3 << rhs13; // NON_COMPLIANT: lhs3's precision is not strictly greater than + // rhs13's + lhs3 << rhs14; // NON_COMPLIANT: lhs3's precision is not strictly greater than + // rhs14's + lhs4 << rhs0; // COMPLIANT: lhs4's precision is strictly greater than rhs0 + lhs4 << rhs1; // COMPLIANT: lhs4's precision is strictly greater than rhs1 + lhs4 << rhs2; // COMPLIANT: lhs4's precision is strictly greater than rhs2 + lhs4 << rhs3; // NON_COMPLIANT: lhs4's precision is not strictly greater than + // rhs3's + lhs4 << rhs4; // NON_COMPLIANT: lhs4's precision is not strictly greater than + // rhs4's + lhs4 << rhs5; // NON_COMPLIANT: lhs4's precision is not strictly greater than + // rhs5's + lhs4 << rhs6; // NON_COMPLIANT: lhs4's precision is not strictly greater than + // rhs6's + lhs4 << rhs7; // NON_COMPLIANT: lhs4's precision is not strictly greater than + // rhs7's + lhs4 << rhs8; // NON_COMPLIANT: lhs4's precision is not strictly greater than + // rhs8's + lhs4 << rhs9; // NON_COMPLIANT: lhs4's precision is not strictly greater than + // rhs9's + lhs4 << rhs10; // NON_COMPLIANT: lhs4's precision is not strictly greater than + // rhs10's + lhs4 << rhs11; // NON_COMPLIANT: lhs4's precision is not strictly greater than + // rhs11's + lhs4 << rhs12; // NON_COMPLIANT: lhs4's precision is not strictly greater than + // rhs12's + lhs4 << rhs13; // NON_COMPLIANT: lhs4's precision is not strictly greater than + // rhs13's + lhs4 << rhs14; // NON_COMPLIANT: lhs4's precision is not strictly greater than + // rhs14's + lhs5 << rhs0; // COMPLIANT: lhs5's precision is strictly greater than rhs0 + lhs5 << rhs1; // COMPLIANT: lhs5's precision is strictly greater than rhs1 + lhs5 << rhs2; // COMPLIANT: lhs5's precision is strictly greater than rhs2 + lhs5 << rhs3; // NON_COMPLIANT: lhs5's precision is not strictly greater than + // rhs3's + lhs5 << rhs4; // NON_COMPLIANT: lhs5's precision is not strictly greater than + // rhs4's + lhs5 << rhs5; // NON_COMPLIANT: lhs5's precision is not strictly greater than + // rhs5's + lhs5 << rhs6; // NON_COMPLIANT: lhs5's precision is not strictly greater than + // rhs6's + lhs5 << rhs7; // NON_COMPLIANT: lhs5's precision is not strictly greater than + // rhs7's + lhs5 << rhs8; // NON_COMPLIANT: lhs5's precision is not strictly greater than + // rhs8's + lhs5 << rhs9; // NON_COMPLIANT: lhs5's precision is not strictly greater than + // rhs9's + lhs5 << rhs10; // NON_COMPLIANT: lhs5's precision is not strictly greater than + // rhs10's + lhs5 << rhs11; // NON_COMPLIANT: lhs5's precision is not strictly greater than + // rhs11's + lhs5 << rhs12; // NON_COMPLIANT: lhs5's precision is not strictly greater than + // rhs12's + lhs5 << rhs13; // NON_COMPLIANT: lhs5's precision is not strictly greater than + // rhs13's + lhs5 << rhs14; // NON_COMPLIANT: lhs5's precision is not strictly greater than + // rhs14's + lhs6 << rhs0; // COMPLIANT: lhs6's precision is strictly greater than rhs0 + lhs6 << rhs1; // COMPLIANT: lhs6's precision is strictly greater than rhs1 + lhs6 << rhs2; // COMPLIANT: lhs6's precision is strictly greater than rhs2 + lhs6 << rhs3; // COMPLIANT: lhs6's precision is strictly greater than rhs3 + lhs6 << rhs4; // COMPLIANT: lhs6's precision is strictly greater than rhs4 + lhs6 << rhs5; // COMPLIANT: lhs6's precision is strictly greater than rhs5 + lhs6 << rhs6; // NON_COMPLIANT: lhs6's precision is not strictly greater than + // rhs6's + lhs6 << rhs7; // COMPLIANT: lhs6's precision is strictly greater than rhs7 + lhs6 << rhs8; // COMPLIANT: lhs6's precision is strictly greater than rhs8 + lhs6 << rhs9; // NON_COMPLIANT: lhs6's precision is not strictly greater than + // rhs9's + lhs6 << rhs10; // COMPLIANT: lhs6's precision is strictly greater than rhs10 + lhs6 << rhs11; // COMPLIANT: lhs6's precision is strictly greater than rhs11 + lhs6 << rhs12; // NON_COMPLIANT: lhs6's precision is not strictly greater than + // rhs12's + lhs6 << rhs13; // NON_COMPLIANT: lhs6's precision is not strictly greater than + // rhs13's + lhs6 << rhs14; // NON_COMPLIANT: lhs6's precision is not strictly greater than + // rhs14's + lhs7 << rhs0; // COMPLIANT: lhs7's precision is strictly greater than rhs0 + lhs7 << rhs1; // COMPLIANT: lhs7's precision is strictly greater than rhs1 + lhs7 << rhs2; // COMPLIANT: lhs7's precision is strictly greater than rhs2 + lhs7 << rhs3; // COMPLIANT: lhs7's precision is strictly greater than rhs3 + lhs7 << rhs4; // COMPLIANT: lhs7's precision is strictly greater than rhs4 + lhs7 << rhs5; // COMPLIANT: lhs7's precision is strictly greater than rhs5 + lhs7 << rhs6; // NON_COMPLIANT: lhs7's precision is not strictly greater than + // rhs6's + lhs7 << rhs7; // NON_COMPLIANT: lhs7's precision is not strictly greater than + // rhs7's + lhs7 << rhs8; // NON_COMPLIANT: lhs7's precision is not strictly greater than + // rhs8's + lhs7 << rhs9; // NON_COMPLIANT: lhs7's precision is not strictly greater than + // rhs9's + lhs7 << rhs10; // NON_COMPLIANT: lhs7's precision is not strictly greater than + // rhs10's + lhs7 << rhs11; // NON_COMPLIANT: lhs7's precision is not strictly greater than + // rhs11's + lhs7 << rhs12; // NON_COMPLIANT: lhs7's precision is not strictly greater than + // rhs12's + lhs7 << rhs13; // NON_COMPLIANT: lhs7's precision is not strictly greater than + // rhs13's + lhs7 << rhs14; // NON_COMPLIANT: lhs7's precision is not strictly greater than + // rhs14's + lhs8 << rhs0; // COMPLIANT: lhs8's precision is strictly greater than rhs0 + lhs8 << rhs1; // COMPLIANT: lhs8's precision is strictly greater than rhs1 + lhs8 << rhs2; // COMPLIANT: lhs8's precision is strictly greater than rhs2 + lhs8 << rhs3; // COMPLIANT: lhs8's precision is strictly greater than rhs3 + lhs8 << rhs4; // COMPLIANT: lhs8's precision is strictly greater than rhs4 + lhs8 << rhs5; // COMPLIANT: lhs8's precision is strictly greater than rhs5 + lhs8 << rhs6; // NON_COMPLIANT: lhs8's precision is not strictly greater than + // rhs6's + lhs8 << rhs7; // NON_COMPLIANT: lhs8's precision is not strictly greater than + // rhs7's + lhs8 << rhs8; // NON_COMPLIANT: lhs8's precision is not strictly greater than + // rhs8's + lhs8 << rhs9; // NON_COMPLIANT: lhs8's precision is not strictly greater than + // rhs9's + lhs8 << rhs10; // NON_COMPLIANT: lhs8's precision is not strictly greater than + // rhs10's + lhs8 << rhs11; // NON_COMPLIANT: lhs8's precision is not strictly greater than + // rhs11's + lhs8 << rhs12; // NON_COMPLIANT: lhs8's precision is not strictly greater than + // rhs12's + lhs8 << rhs13; // NON_COMPLIANT: lhs8's precision is not strictly greater than + // rhs13's + lhs8 << rhs14; // NON_COMPLIANT: lhs8's precision is not strictly greater than + // rhs14's + lhs9 << rhs0; // COMPLIANT: lhs9's precision is strictly greater than rhs0 + lhs9 << rhs1; // COMPLIANT: lhs9's precision is strictly greater than rhs1 + lhs9 << rhs2; // COMPLIANT: lhs9's precision is strictly greater than rhs2 + lhs9 << rhs3; // COMPLIANT: lhs9's precision is strictly greater than rhs3 + lhs9 << rhs4; // COMPLIANT: lhs9's precision is strictly greater than rhs4 + lhs9 << rhs5; // COMPLIANT: lhs9's precision is strictly greater than rhs5 + lhs9 << rhs6; // NON_COMPLIANT: lhs9's precision is not strictly greater than + // rhs6's + lhs9 << rhs7; // COMPLIANT: lhs9's precision is strictly greater than rhs7 + lhs9 << rhs8; // COMPLIANT: lhs9's precision is strictly greater than rhs8 + lhs9 << rhs9; // NON_COMPLIANT: lhs9's precision is not strictly greater than + // rhs9's + lhs9 << rhs10; // COMPLIANT: lhs9's precision is strictly greater than rhs10 + lhs9 << rhs11; // COMPLIANT: lhs9's precision is strictly greater than rhs11 + lhs9 << rhs12; // NON_COMPLIANT: lhs9's precision is not strictly greater than + // rhs12's + lhs9 << rhs13; // NON_COMPLIANT: lhs9's precision is not strictly greater than + // rhs13's + lhs9 << rhs14; // NON_COMPLIANT: lhs9's precision is not strictly greater than + // rhs14's + lhs10 << rhs0; // COMPLIANT: lhs10's precision is strictly greater than rhs0 + lhs10 << rhs1; // COMPLIANT: lhs10's precision is strictly greater than rhs1 + lhs10 << rhs2; // COMPLIANT: lhs10's precision is strictly greater than rhs2 + lhs10 << rhs3; // COMPLIANT: lhs10's precision is strictly greater than rhs3 + lhs10 << rhs4; // COMPLIANT: lhs10's precision is strictly greater than rhs4 + lhs10 << rhs5; // COMPLIANT: lhs10's precision is strictly greater than rhs5 + lhs10 << rhs6; // NON_COMPLIANT: lhs10's precision is not strictly greater + // than rhs6's + lhs10 << rhs7; // NON_COMPLIANT: lhs10's precision is not strictly greater + // than rhs7's + lhs10 << rhs8; // NON_COMPLIANT: lhs10's precision is not strictly greater + // than rhs8's + lhs10 << rhs9; // NON_COMPLIANT: lhs10's precision is not strictly greater + // than rhs9's + lhs10 << rhs10; // NON_COMPLIANT: lhs10's precision is not strictly greater + // than rhs10's + lhs10 << rhs11; // NON_COMPLIANT: lhs10's precision is not strictly greater + // than rhs11's + lhs10 << rhs12; // NON_COMPLIANT: lhs10's precision is not strictly greater + // than rhs12's + lhs10 << rhs13; // NON_COMPLIANT: lhs10's precision is not strictly greater + // than rhs13's + lhs10 << rhs14; // NON_COMPLIANT: lhs10's precision is not strictly greater + // than rhs14's + lhs11 << rhs0; // COMPLIANT: lhs11's precision is strictly greater than rhs0 + lhs11 << rhs1; // COMPLIANT: lhs11's precision is strictly greater than rhs1 + lhs11 << rhs2; // COMPLIANT: lhs11's precision is strictly greater than rhs2 + lhs11 << rhs3; // COMPLIANT: lhs11's precision is strictly greater than rhs3 + lhs11 << rhs4; // COMPLIANT: lhs11's precision is strictly greater than rhs4 + lhs11 << rhs5; // COMPLIANT: lhs11's precision is strictly greater than rhs5 + lhs11 << rhs6; // NON_COMPLIANT: lhs11's precision is not strictly greater + // than rhs6's + lhs11 << rhs7; // NON_COMPLIANT: lhs11's precision is not strictly greater + // than rhs7's + lhs11 << rhs8; // NON_COMPLIANT: lhs11's precision is not strictly greater + // than rhs8's + lhs11 << rhs9; // NON_COMPLIANT: lhs11's precision is not strictly greater + // than rhs9's + lhs11 << rhs10; // NON_COMPLIANT: lhs11's precision is not strictly greater + // than rhs10's + lhs11 << rhs11; // NON_COMPLIANT: lhs11's precision is not strictly greater + // than rhs11's + lhs11 << rhs12; // NON_COMPLIANT: lhs11's precision is not strictly greater + // than rhs12's + lhs11 << rhs13; // NON_COMPLIANT: lhs11's precision is not strictly greater + // than rhs13's + lhs11 << rhs14; // NON_COMPLIANT: lhs11's precision is not strictly greater + // than rhs14's + lhs12 << rhs0; // COMPLIANT: lhs12's precision is strictly greater than rhs0 + lhs12 << rhs1; // COMPLIANT: lhs12's precision is strictly greater than rhs1 + lhs12 << rhs2; // COMPLIANT: lhs12's precision is strictly greater than rhs2 + lhs12 << rhs3; // COMPLIANT: lhs12's precision is strictly greater than rhs3 + lhs12 << rhs4; // COMPLIANT: lhs12's precision is strictly greater than rhs4 + lhs12 << rhs5; // COMPLIANT: lhs12's precision is strictly greater than rhs5 + lhs12 << rhs6; // COMPLIANT: lhs12's precision is strictly greater than rhs6 + lhs12 << rhs7; // COMPLIANT: lhs12's precision is strictly greater than rhs7 + lhs12 << rhs8; // COMPLIANT: lhs12's precision is strictly greater than rhs8 + lhs12 << rhs9; // COMPLIANT: lhs12's precision is strictly greater than rhs9 + lhs12 << rhs10; // COMPLIANT: lhs12's precision is strictly greater than rhs10 + lhs12 << rhs11; // COMPLIANT: lhs12's precision is strictly greater than rhs11 + lhs12 << rhs12; // NON_COMPLIANT: lhs12's precision is not strictly greater + // than rhs12's + lhs12 << rhs13; // COMPLIANT: lhs12's precision is strictly greater than rhs13 + lhs12 << rhs14; // COMPLIANT: lhs12's precision is strictly greater than rhs14 + lhs13 << rhs0; // COMPLIANT: lhs13's precision is strictly greater than rhs0 + lhs13 << rhs1; // COMPLIANT: lhs13's precision is strictly greater than rhs1 + lhs13 << rhs2; // COMPLIANT: lhs13's precision is strictly greater than rhs2 + lhs13 << rhs3; // COMPLIANT: lhs13's precision is strictly greater than rhs3 + lhs13 << rhs4; // COMPLIANT: lhs13's precision is strictly greater than rhs4 + lhs13 << rhs5; // COMPLIANT: lhs13's precision is strictly greater than rhs5 + lhs13 << rhs6; // COMPLIANT: lhs13's precision is strictly greater than rhs6 + lhs13 << rhs7; // COMPLIANT: lhs13's precision is strictly greater than rhs7 + lhs13 << rhs8; // COMPLIANT: lhs13's precision is strictly greater than rhs8 + lhs13 << rhs9; // COMPLIANT: lhs13's precision is strictly greater than rhs9 + lhs13 << rhs10; // COMPLIANT: lhs13's precision is strictly greater than rhs10 + lhs13 << rhs11; // COMPLIANT: lhs13's precision is strictly greater than rhs11 + lhs13 << rhs12; // NON_COMPLIANT: lhs13's precision is not strictly greater + // than rhs12's + lhs13 << rhs13; // NON_COMPLIANT: lhs13's precision is not strictly greater + // than rhs13's + lhs13 << rhs14; // NON_COMPLIANT: lhs13's precision is not strictly greater + // than rhs14's + lhs14 << rhs0; // COMPLIANT: lhs14's precision is strictly greater than rhs0 + lhs14 << rhs1; // COMPLIANT: lhs14's precision is strictly greater than rhs1 + lhs14 << rhs2; // COMPLIANT: lhs14's precision is strictly greater than rhs2 + lhs14 << rhs3; // COMPLIANT: lhs14's precision is strictly greater than rhs3 + lhs14 << rhs4; // COMPLIANT: lhs14's precision is strictly greater than rhs4 + lhs14 << rhs5; // COMPLIANT: lhs14's precision is strictly greater than rhs5 + lhs14 << rhs6; // COMPLIANT: lhs14's precision is strictly greater than rhs6 + lhs14 << rhs7; // COMPLIANT: lhs14's precision is strictly greater than rhs7 + lhs14 << rhs8; // COMPLIANT: lhs14's precision is strictly greater than rhs8 + lhs14 << rhs9; // COMPLIANT: lhs14's precision is strictly greater than rhs9 + lhs14 << rhs10; // COMPLIANT: lhs14's precision is strictly greater than rhs10 + lhs14 << rhs11; // COMPLIANT: lhs14's precision is strictly greater than rhs11 + lhs14 << rhs12; // NON_COMPLIANT: lhs14's precision is not strictly greater + // than rhs12's + lhs14 << rhs13; // NON_COMPLIANT: lhs14's precision is not strictly greater + // than rhs13's + lhs14 << rhs14; // NON_COMPLIANT: lhs14's precision is not strictly greater + // than rhs14's + + /* ===== Left shift with guards, the shift expression is at `then` branch + * ===== */ + + if (rhs0 < PRECISION(UCHAR_MAX)) + lhs0 << rhs0; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs0, but it's inside a PRECISION guard + if (rhs3 < PRECISION(UCHAR_MAX)) + lhs0 << rhs3; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs3, but it's inside a PRECISION guard + if (rhs4 < PRECISION(UCHAR_MAX)) + lhs0 << rhs4; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs4, but it's inside a PRECISION guard + if (rhs5 < PRECISION(UCHAR_MAX)) + lhs0 << rhs5; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs5, but it's inside a PRECISION guard + if (rhs6 < PRECISION(UCHAR_MAX)) + lhs0 << rhs6; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + if (rhs7 < PRECISION(UCHAR_MAX)) + lhs0 << rhs7; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + if (rhs8 < PRECISION(UCHAR_MAX)) + lhs0 << rhs8; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + if (rhs9 < PRECISION(UCHAR_MAX)) + lhs0 << rhs9; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + if (rhs10 < PRECISION(UCHAR_MAX)) + lhs0 << rhs10; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + if (rhs11 < PRECISION(UCHAR_MAX)) + lhs0 << rhs11; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + if (rhs12 < PRECISION(UCHAR_MAX)) + lhs0 << rhs12; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(UCHAR_MAX)) + lhs0 << rhs13; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(UCHAR_MAX)) + lhs0 << rhs14; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + if (rhs0 < PRECISION(CHAR_MAX)) + lhs1 << rhs0; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs0, but it's inside a PRECISION guard + if (rhs1 < PRECISION(CHAR_MAX)) + lhs1 << rhs1; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs1, but it's inside a PRECISION guard + if (rhs2 < PRECISION(CHAR_MAX)) + lhs1 << rhs2; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs2, but it's inside a PRECISION guard + if (rhs3 < PRECISION(CHAR_MAX)) + lhs1 << rhs3; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs3, but it's inside a PRECISION guard + if (rhs4 < PRECISION(CHAR_MAX)) + lhs1 << rhs4; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs4, but it's inside a PRECISION guard + if (rhs5 < PRECISION(CHAR_MAX)) + lhs1 << rhs5; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs5, but it's inside a PRECISION guard + if (rhs6 < PRECISION(CHAR_MAX)) + lhs1 << rhs6; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + if (rhs7 < PRECISION(CHAR_MAX)) + lhs1 << rhs7; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + if (rhs8 < PRECISION(CHAR_MAX)) + lhs1 << rhs8; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + if (rhs9 < PRECISION(CHAR_MAX)) + lhs1 << rhs9; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + if (rhs10 < PRECISION(CHAR_MAX)) + lhs1 << rhs10; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + if (rhs11 < PRECISION(CHAR_MAX)) + lhs1 << rhs11; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + if (rhs12 < PRECISION(CHAR_MAX)) + lhs1 << rhs12; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(CHAR_MAX)) + lhs1 << rhs13; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(CHAR_MAX)) + lhs1 << rhs14; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + if (rhs0 < PRECISION(CHAR_MAX)) + lhs2 << rhs0; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs0, but it's inside a PRECISION guard + if (rhs1 < PRECISION(CHAR_MAX)) + lhs2 << rhs1; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs1, but it's inside a PRECISION guard + if (rhs2 < PRECISION(CHAR_MAX)) + lhs2 << rhs2; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs2, but it's inside a PRECISION guard + if (rhs3 < PRECISION(CHAR_MAX)) + lhs2 << rhs3; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs3, but it's inside a PRECISION guard + if (rhs4 < PRECISION(CHAR_MAX)) + lhs2 << rhs4; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs4, but it's inside a PRECISION guard + if (rhs5 < PRECISION(CHAR_MAX)) + lhs2 << rhs5; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs5, but it's inside a PRECISION guard + if (rhs6 < PRECISION(CHAR_MAX)) + lhs2 << rhs6; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + if (rhs7 < PRECISION(CHAR_MAX)) + lhs2 << rhs7; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + if (rhs8 < PRECISION(CHAR_MAX)) + lhs2 << rhs8; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + if (rhs9 < PRECISION(CHAR_MAX)) + lhs2 << rhs9; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + if (rhs10 < PRECISION(CHAR_MAX)) + lhs2 << rhs10; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + if (rhs11 < PRECISION(CHAR_MAX)) + lhs2 << rhs11; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + if (rhs12 < PRECISION(CHAR_MAX)) + lhs2 << rhs12; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(CHAR_MAX)) + lhs2 << rhs13; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(CHAR_MAX)) + lhs2 << rhs14; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + if (rhs3 < PRECISION(USHRT_MAX)) + lhs3 << rhs3; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs3, but it's inside a PRECISION guard + if (rhs6 < PRECISION(USHRT_MAX)) + lhs3 << rhs6; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + if (rhs7 < PRECISION(USHRT_MAX)) + lhs3 << rhs7; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + if (rhs8 < PRECISION(USHRT_MAX)) + lhs3 << rhs8; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + if (rhs9 < PRECISION(USHRT_MAX)) + lhs3 << rhs9; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + if (rhs10 < PRECISION(USHRT_MAX)) + lhs3 << rhs10; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + if (rhs11 < PRECISION(USHRT_MAX)) + lhs3 << rhs11; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + if (rhs12 < PRECISION(USHRT_MAX)) + lhs3 << rhs12; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(USHRT_MAX)) + lhs3 << rhs13; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(USHRT_MAX)) + lhs3 << rhs14; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + if (rhs3 < PRECISION(SHRT_MAX)) + lhs4 << rhs3; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs3, but it's inside a PRECISION guard + if (rhs4 < PRECISION(SHRT_MAX)) + lhs4 << rhs4; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs4, but it's inside a PRECISION guard + if (rhs5 < PRECISION(SHRT_MAX)) + lhs4 << rhs5; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs5, but it's inside a PRECISION guard + if (rhs6 < PRECISION(SHRT_MAX)) + lhs4 << rhs6; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + if (rhs7 < PRECISION(SHRT_MAX)) + lhs4 << rhs7; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + if (rhs8 < PRECISION(SHRT_MAX)) + lhs4 << rhs8; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + if (rhs9 < PRECISION(SHRT_MAX)) + lhs4 << rhs9; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + if (rhs10 < PRECISION(SHRT_MAX)) + lhs4 << rhs10; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + if (rhs11 < PRECISION(SHRT_MAX)) + lhs4 << rhs11; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + if (rhs12 < PRECISION(SHRT_MAX)) + lhs4 << rhs12; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(SHRT_MAX)) + lhs4 << rhs13; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(SHRT_MAX)) + lhs4 << rhs14; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + if (rhs3 < PRECISION(SHRT_MAX)) + lhs5 << rhs3; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs3, but it's inside a PRECISION guard + if (rhs4 < PRECISION(SHRT_MAX)) + lhs5 << rhs4; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs4, but it's inside a PRECISION guard + if (rhs5 < PRECISION(SHRT_MAX)) + lhs5 << rhs5; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs5, but it's inside a PRECISION guard + if (rhs6 < PRECISION(SHRT_MAX)) + lhs5 << rhs6; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + if (rhs7 < PRECISION(SHRT_MAX)) + lhs5 << rhs7; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + if (rhs8 < PRECISION(SHRT_MAX)) + lhs5 << rhs8; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + if (rhs9 < PRECISION(SHRT_MAX)) + lhs5 << rhs9; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + if (rhs10 < PRECISION(SHRT_MAX)) + lhs5 << rhs10; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + if (rhs11 < PRECISION(SHRT_MAX)) + lhs5 << rhs11; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + if (rhs12 < PRECISION(SHRT_MAX)) + lhs5 << rhs12; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(SHRT_MAX)) + lhs5 << rhs13; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(SHRT_MAX)) + lhs5 << rhs14; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + if (rhs6 < PRECISION(UINT_MAX)) + lhs6 << rhs6; // COMPLIANT: lhs6's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + if (rhs9 < PRECISION(UINT_MAX)) + lhs6 << rhs9; // COMPLIANT: lhs6's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + if (rhs12 < PRECISION(UINT_MAX)) + lhs6 << rhs12; // COMPLIANT: lhs6's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(UINT_MAX)) + lhs6 << rhs13; // COMPLIANT: lhs6's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(UINT_MAX)) + lhs6 << rhs14; // COMPLIANT: lhs6's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + if (rhs6 < PRECISION(INT_MAX)) + lhs7 << rhs6; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + if (rhs7 < PRECISION(INT_MAX)) + lhs7 << rhs7; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + if (rhs8 < PRECISION(INT_MAX)) + lhs7 << rhs8; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + if (rhs9 < PRECISION(INT_MAX)) + lhs7 << rhs9; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + if (rhs10 < PRECISION(INT_MAX)) + lhs7 << rhs10; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + if (rhs11 < PRECISION(INT_MAX)) + lhs7 << rhs11; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + if (rhs12 < PRECISION(INT_MAX)) + lhs7 << rhs12; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(INT_MAX)) + lhs7 << rhs13; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(INT_MAX)) + lhs7 << rhs14; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + if (rhs6 < PRECISION(INT_MAX)) + lhs8 << rhs6; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + if (rhs7 < PRECISION(INT_MAX)) + lhs8 << rhs7; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + if (rhs8 < PRECISION(INT_MAX)) + lhs8 << rhs8; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + if (rhs9 < PRECISION(INT_MAX)) + lhs8 << rhs9; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + if (rhs10 < PRECISION(INT_MAX)) + lhs8 << rhs10; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + if (rhs11 < PRECISION(INT_MAX)) + lhs8 << rhs11; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + if (rhs12 < PRECISION(INT_MAX)) + lhs8 << rhs12; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(INT_MAX)) + lhs8 << rhs13; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(INT_MAX)) + lhs8 << rhs14; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + if (rhs6 < PRECISION(ULONG_MAX)) + lhs9 << rhs6; // COMPLIANT: lhs9's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + if (rhs9 < PRECISION(ULONG_MAX)) + lhs9 << rhs9; // COMPLIANT: lhs9's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + if (rhs12 < PRECISION(ULONG_MAX)) + lhs9 << rhs12; // COMPLIANT: lhs9's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(ULONG_MAX)) + lhs9 << rhs13; // COMPLIANT: lhs9's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(ULONG_MAX)) + lhs9 << rhs14; // COMPLIANT: lhs9's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + if (rhs6 < PRECISION(LONG_MAX)) + lhs10 << rhs6; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + if (rhs7 < PRECISION(LONG_MAX)) + lhs10 << rhs7; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + if (rhs8 < PRECISION(LONG_MAX)) + lhs10 << rhs8; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + if (rhs9 < PRECISION(LONG_MAX)) + lhs10 << rhs9; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + if (rhs10 < PRECISION(LONG_MAX)) + lhs10 << rhs10; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + if (rhs11 < PRECISION(LONG_MAX)) + lhs10 << rhs11; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + if (rhs12 < PRECISION(LONG_MAX)) + lhs10 << rhs12; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(LONG_MAX)) + lhs10 << rhs13; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(LONG_MAX)) + lhs10 << rhs14; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + if (rhs6 < PRECISION(LONG_MAX)) + lhs11 << rhs6; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + if (rhs7 < PRECISION(LONG_MAX)) + lhs11 << rhs7; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + if (rhs8 < PRECISION(LONG_MAX)) + lhs11 << rhs8; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + if (rhs9 < PRECISION(LONG_MAX)) + lhs11 << rhs9; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + if (rhs10 < PRECISION(LONG_MAX)) + lhs11 << rhs10; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + if (rhs11 < PRECISION(LONG_MAX)) + lhs11 << rhs11; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + if (rhs12 < PRECISION(LONG_MAX)) + lhs11 << rhs12; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(LONG_MAX)) + lhs11 << rhs13; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(LONG_MAX)) + lhs11 << rhs14; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + if (rhs12 < PRECISION(ULLONG_MAX)) + lhs12 << rhs12; // COMPLIANT: lhs12's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs12 < PRECISION(LLONG_MAX)) + lhs13 << rhs12; // COMPLIANT: lhs13's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(LLONG_MAX)) + lhs13 << rhs13; // COMPLIANT: lhs13's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(LLONG_MAX)) + lhs13 << rhs14; // COMPLIANT: lhs13's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + if (rhs12 < PRECISION(LLONG_MAX)) + lhs14 << rhs12; // COMPLIANT: lhs14's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(LLONG_MAX)) + lhs14 << rhs13; // COMPLIANT: lhs14's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(LLONG_MAX)) + lhs14 << rhs14; // COMPLIANT: lhs14's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + + /* ===== Left shift with guards, the shift expression is at `else` branch + * ===== */ + + if (rhs0 >= PRECISION(UCHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs0 << rhs0; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs0, but it's inside a PRECISION guard + } + if (rhs3 >= PRECISION(UCHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs0 << rhs3; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs3, but it's inside a PRECISION guard + } + if (rhs4 >= PRECISION(UCHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs0 << rhs4; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs4, but it's inside a PRECISION guard + } + if (rhs5 >= PRECISION(UCHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs0 << rhs5; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs5, but it's inside a PRECISION guard + } + if (rhs6 >= PRECISION(UCHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs0 << rhs6; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + } + if (rhs7 >= PRECISION(UCHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs0 << rhs7; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + } + if (rhs8 >= PRECISION(UCHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs0 << rhs8; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + } + if (rhs9 >= PRECISION(UCHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs0 << rhs9; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + } + if (rhs10 >= PRECISION(UCHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs0 << rhs10; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + } + if (rhs11 >= PRECISION(UCHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs0 << rhs11; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(UCHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs0 << rhs12; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(UCHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs0 << rhs13; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(UCHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs0 << rhs14; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } + if (rhs0 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 << rhs0; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs0, but it's inside a PRECISION guard + } + if (rhs1 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 << rhs1; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs1, but it's inside a PRECISION guard + } + if (rhs2 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 << rhs2; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs2, but it's inside a PRECISION guard + } + if (rhs3 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 << rhs3; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs3, but it's inside a PRECISION guard + } + if (rhs4 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 << rhs4; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs4, but it's inside a PRECISION guard + } + if (rhs5 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 << rhs5; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs5, but it's inside a PRECISION guard + } + if (rhs6 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 << rhs6; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + } + if (rhs7 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 << rhs7; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + } + if (rhs8 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 << rhs8; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + } + if (rhs9 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 << rhs9; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + } + if (rhs10 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 << rhs10; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + } + if (rhs11 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 << rhs11; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 << rhs12; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 << rhs13; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 << rhs14; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } + if (rhs0 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 << rhs0; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs0, but it's inside a PRECISION guard + } + if (rhs1 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 << rhs1; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs1, but it's inside a PRECISION guard + } + if (rhs2 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 << rhs2; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs2, but it's inside a PRECISION guard + } + if (rhs3 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 << rhs3; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs3, but it's inside a PRECISION guard + } + if (rhs4 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 << rhs4; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs4, but it's inside a PRECISION guard + } + if (rhs5 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 << rhs5; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs5, but it's inside a PRECISION guard + } + if (rhs6 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 << rhs6; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + } + if (rhs7 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 << rhs7; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + } + if (rhs8 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 << rhs8; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + } + if (rhs9 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 << rhs9; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + } + if (rhs10 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 << rhs10; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + } + if (rhs11 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 << rhs11; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 << rhs12; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 << rhs13; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 << rhs14; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } + if (rhs3 >= PRECISION(USHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs3 << rhs3; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs3, but it's inside a PRECISION guard + } + if (rhs6 >= PRECISION(USHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs3 << rhs6; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + } + if (rhs7 >= PRECISION(USHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs3 << rhs7; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + } + if (rhs8 >= PRECISION(USHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs3 << rhs8; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + } + if (rhs9 >= PRECISION(USHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs3 << rhs9; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + } + if (rhs10 >= PRECISION(USHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs3 << rhs10; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + } + if (rhs11 >= PRECISION(USHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs3 << rhs11; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(USHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs3 << rhs12; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(USHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs3 << rhs13; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(USHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs3 << rhs14; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } + if (rhs3 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs4 << rhs3; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs3, but it's inside a PRECISION guard + } + if (rhs4 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs4 << rhs4; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs4, but it's inside a PRECISION guard + } + if (rhs5 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs4 << rhs5; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs5, but it's inside a PRECISION guard + } + if (rhs6 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs4 << rhs6; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + } + if (rhs7 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs4 << rhs7; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + } + if (rhs8 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs4 << rhs8; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + } + if (rhs9 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs4 << rhs9; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + } + if (rhs10 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs4 << rhs10; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + } + if (rhs11 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs4 << rhs11; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs4 << rhs12; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs4 << rhs13; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs4 << rhs14; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } + if (rhs3 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs5 << rhs3; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs3, but it's inside a PRECISION guard + } + if (rhs4 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs5 << rhs4; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs4, but it's inside a PRECISION guard + } + if (rhs5 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs5 << rhs5; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs5, but it's inside a PRECISION guard + } + if (rhs6 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs5 << rhs6; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + } + if (rhs7 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs5 << rhs7; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + } + if (rhs8 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs5 << rhs8; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + } + if (rhs9 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs5 << rhs9; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + } + if (rhs10 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs5 << rhs10; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + } + if (rhs11 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs5 << rhs11; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs5 << rhs12; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs5 << rhs13; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs5 << rhs14; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } + if (rhs6 >= PRECISION(UINT_MAX)) { + ; /* Handle Error */ + } else { + lhs6 << rhs6; // COMPLIANT: lhs6's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + } + if (rhs9 >= PRECISION(UINT_MAX)) { + ; /* Handle Error */ + } else { + lhs6 << rhs9; // COMPLIANT: lhs6's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(UINT_MAX)) { + ; /* Handle Error */ + } else { + lhs6 << rhs12; // COMPLIANT: lhs6's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(UINT_MAX)) { + ; /* Handle Error */ + } else { + lhs6 << rhs13; // COMPLIANT: lhs6's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(UINT_MAX)) { + ; /* Handle Error */ + } else { + lhs6 << rhs14; // COMPLIANT: lhs6's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } + if (rhs6 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs7 << rhs6; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + } + if (rhs7 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs7 << rhs7; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + } + if (rhs8 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs7 << rhs8; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + } + if (rhs9 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs7 << rhs9; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + } + if (rhs10 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs7 << rhs10; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + } + if (rhs11 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs7 << rhs11; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs7 << rhs12; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs7 << rhs13; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs7 << rhs14; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } + if (rhs6 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs8 << rhs6; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + } + if (rhs7 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs8 << rhs7; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + } + if (rhs8 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs8 << rhs8; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + } + if (rhs9 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs8 << rhs9; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + } + if (rhs10 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs8 << rhs10; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + } + if (rhs11 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs8 << rhs11; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs8 << rhs12; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs8 << rhs13; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs8 << rhs14; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } + if (rhs6 >= PRECISION(ULONG_MAX)) { + ; /* Handle Error */ + } else { + lhs9 << rhs6; // COMPLIANT: lhs9's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + } + if (rhs9 >= PRECISION(ULONG_MAX)) { + ; /* Handle Error */ + } else { + lhs9 << rhs9; // COMPLIANT: lhs9's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(ULONG_MAX)) { + ; /* Handle Error */ + } else { + lhs9 << rhs12; // COMPLIANT: lhs9's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(ULONG_MAX)) { + ; /* Handle Error */ + } else { + lhs9 << rhs13; // COMPLIANT: lhs9's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(ULONG_MAX)) { + ; /* Handle Error */ + } else { + lhs9 << rhs14; // COMPLIANT: lhs9's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } + if (rhs6 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs10 << rhs6; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + } + if (rhs7 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs10 << rhs7; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + } + if (rhs8 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs10 << rhs8; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + } + if (rhs9 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs10 << rhs9; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + } + if (rhs10 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs10 << rhs10; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + } + if (rhs11 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs10 << rhs11; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs10 << rhs12; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs10 << rhs13; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs10 << rhs14; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } + if (rhs6 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs11 << rhs6; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + } + if (rhs7 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs11 << rhs7; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + } + if (rhs8 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs11 << rhs8; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + } + if (rhs9 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs11 << rhs9; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + } + if (rhs10 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs11 << rhs10; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + } + if (rhs11 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs11 << rhs11; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs11 << rhs12; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs11 << rhs13; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs11 << rhs14; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(ULLONG_MAX)) { + ; /* Handle Error */ + } else { + lhs12 << rhs12; // COMPLIANT: lhs12's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(LLONG_MAX)) { + ; /* Handle Error */ + } else { + lhs13 << rhs12; // COMPLIANT: lhs13's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(LLONG_MAX)) { + ; /* Handle Error */ + } else { + lhs13 << rhs13; // COMPLIANT: lhs13's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(LLONG_MAX)) { + ; /* Handle Error */ + } else { + lhs13 << rhs14; // COMPLIANT: lhs13's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(LLONG_MAX)) { + ; /* Handle Error */ + } else { + lhs14 << rhs12; // COMPLIANT: lhs14's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(LLONG_MAX)) { + ; /* Handle Error */ + } else { + lhs14 << rhs13; // COMPLIANT: lhs14's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(LLONG_MAX)) { + ; /* Handle Error */ + } else { + lhs14 << rhs14; // COMPLIANT: lhs14's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } + + /* ========== Right shifts ========== */ + + lhs0 >> + rhs0; // NON_COMPLIANT: lhs0's precision is not strictly greater than rhs0 + lhs0 >> rhs1; // COMPLIANT: lhs0's precision is strictly greater than rhs1 + lhs0 >> rhs2; // COMPLIANT: lhs0's precision is strictly greater than rhs2 + lhs0 >> + rhs3; // NON_COMPLIANT: lhs0's precision is not strictly greater than rhs3 + lhs0 >> + rhs4; // NON_COMPLIANT: lhs0's precision is not strictly greater than rhs4 + lhs0 >> + rhs5; // NON_COMPLIANT: lhs0's precision is not strictly greater than rhs5 + lhs0 >> + rhs6; // NON_COMPLIANT: lhs0's precision is not strictly greater than rhs6 + lhs0 >> + rhs7; // NON_COMPLIANT: lhs0's precision is not strictly greater than rhs7 + lhs0 >> + rhs8; // NON_COMPLIANT: lhs0's precision is not strictly greater than rhs8 + lhs0 >> + rhs9; // NON_COMPLIANT: lhs0's precision is not strictly greater than rhs9 + lhs0 >> rhs10; // NON_COMPLIANT: lhs0's precision is not strictly greater than + // rhs10 + lhs0 >> rhs11; // NON_COMPLIANT: lhs0's precision is not strictly greater than + // rhs11 + lhs0 >> rhs12; // NON_COMPLIANT: lhs0's precision is not strictly greater than + // rhs12 + lhs0 >> rhs13; // NON_COMPLIANT: lhs0's precision is not strictly greater than + // rhs13 + lhs0 >> rhs14; // NON_COMPLIANT: lhs0's precision is not strictly greater than + // rhs14 + lhs1 >> + rhs0; // NON_COMPLIANT: lhs1's precision is not strictly greater than rhs0 + lhs1 >> + rhs1; // NON_COMPLIANT: lhs1's precision is not strictly greater than rhs1 + lhs1 >> + rhs2; // NON_COMPLIANT: lhs1's precision is not strictly greater than rhs2 + lhs1 >> + rhs3; // NON_COMPLIANT: lhs1's precision is not strictly greater than rhs3 + lhs1 >> + rhs4; // NON_COMPLIANT: lhs1's precision is not strictly greater than rhs4 + lhs1 >> + rhs5; // NON_COMPLIANT: lhs1's precision is not strictly greater than rhs5 + lhs1 >> + rhs6; // NON_COMPLIANT: lhs1's precision is not strictly greater than rhs6 + lhs1 >> + rhs7; // NON_COMPLIANT: lhs1's precision is not strictly greater than rhs7 + lhs1 >> + rhs8; // NON_COMPLIANT: lhs1's precision is not strictly greater than rhs8 + lhs1 >> + rhs9; // NON_COMPLIANT: lhs1's precision is not strictly greater than rhs9 + lhs1 >> rhs10; // NON_COMPLIANT: lhs1's precision is not strictly greater than + // rhs10 + lhs1 >> rhs11; // NON_COMPLIANT: lhs1's precision is not strictly greater than + // rhs11 + lhs1 >> rhs12; // NON_COMPLIANT: lhs1's precision is not strictly greater than + // rhs12 + lhs1 >> rhs13; // NON_COMPLIANT: lhs1's precision is not strictly greater than + // rhs13 + lhs1 >> rhs14; // NON_COMPLIANT: lhs1's precision is not strictly greater than + // rhs14 + lhs2 >> + rhs0; // NON_COMPLIANT: lhs2's precision is not strictly greater than rhs0 + lhs2 >> + rhs1; // NON_COMPLIANT: lhs2's precision is not strictly greater than rhs1 + lhs2 >> + rhs2; // NON_COMPLIANT: lhs2's precision is not strictly greater than rhs2 + lhs2 >> + rhs3; // NON_COMPLIANT: lhs2's precision is not strictly greater than rhs3 + lhs2 >> + rhs4; // NON_COMPLIANT: lhs2's precision is not strictly greater than rhs4 + lhs2 >> + rhs5; // NON_COMPLIANT: lhs2's precision is not strictly greater than rhs5 + lhs2 >> + rhs6; // NON_COMPLIANT: lhs2's precision is not strictly greater than rhs6 + lhs2 >> + rhs7; // NON_COMPLIANT: lhs2's precision is not strictly greater than rhs7 + lhs2 >> + rhs8; // NON_COMPLIANT: lhs2's precision is not strictly greater than rhs8 + lhs2 >> + rhs9; // NON_COMPLIANT: lhs2's precision is not strictly greater than rhs9 + lhs2 >> rhs10; // NON_COMPLIANT: lhs2's precision is not strictly greater than + // rhs10 + lhs2 >> rhs11; // NON_COMPLIANT: lhs2's precision is not strictly greater than + // rhs11 + lhs2 >> rhs12; // NON_COMPLIANT: lhs2's precision is not strictly greater than + // rhs12 + lhs2 >> rhs13; // NON_COMPLIANT: lhs2's precision is not strictly greater than + // rhs13 + lhs2 >> rhs14; // NON_COMPLIANT: lhs2's precision is not strictly greater than + // rhs14 + lhs3 >> rhs0; // COMPLIANT: lhs3's precision is strictly greater than rhs0 + lhs3 >> rhs1; // COMPLIANT: lhs3's precision is strictly greater than rhs1 + lhs3 >> rhs2; // COMPLIANT: lhs3's precision is strictly greater than rhs2 + lhs3 >> + rhs3; // NON_COMPLIANT: lhs3's precision is not strictly greater than rhs3 + lhs3 >> rhs4; // COMPLIANT: lhs3's precision is strictly greater than rhs4 + lhs3 >> rhs5; // COMPLIANT: lhs3's precision is strictly greater than rhs5 + lhs3 >> + rhs6; // NON_COMPLIANT: lhs3's precision is not strictly greater than rhs6 + lhs3 >> + rhs7; // NON_COMPLIANT: lhs3's precision is not strictly greater than rhs7 + lhs3 >> + rhs8; // NON_COMPLIANT: lhs3's precision is not strictly greater than rhs8 + lhs3 >> + rhs9; // NON_COMPLIANT: lhs3's precision is not strictly greater than rhs9 + lhs3 >> rhs10; // NON_COMPLIANT: lhs3's precision is not strictly greater than + // rhs10 + lhs3 >> rhs11; // NON_COMPLIANT: lhs3's precision is not strictly greater than + // rhs11 + lhs3 >> rhs12; // NON_COMPLIANT: lhs3's precision is not strictly greater than + // rhs12 + lhs3 >> rhs13; // NON_COMPLIANT: lhs3's precision is not strictly greater than + // rhs13 + lhs3 >> rhs14; // NON_COMPLIANT: lhs3's precision is not strictly greater than + // rhs14 + lhs4 >> rhs0; // COMPLIANT: lhs4's precision is strictly greater than rhs0 + lhs4 >> rhs1; // COMPLIANT: lhs4's precision is strictly greater than rhs1 + lhs4 >> rhs2; // COMPLIANT: lhs4's precision is strictly greater than rhs2 + lhs4 >> + rhs3; // NON_COMPLIANT: lhs4's precision is not strictly greater than rhs3 + lhs4 >> + rhs4; // NON_COMPLIANT: lhs4's precision is not strictly greater than rhs4 + lhs4 >> + rhs5; // NON_COMPLIANT: lhs4's precision is not strictly greater than rhs5 + lhs4 >> + rhs6; // NON_COMPLIANT: lhs4's precision is not strictly greater than rhs6 + lhs4 >> + rhs7; // NON_COMPLIANT: lhs4's precision is not strictly greater than rhs7 + lhs4 >> + rhs8; // NON_COMPLIANT: lhs4's precision is not strictly greater than rhs8 + lhs4 >> + rhs9; // NON_COMPLIANT: lhs4's precision is not strictly greater than rhs9 + lhs4 >> rhs10; // NON_COMPLIANT: lhs4's precision is not strictly greater than + // rhs10 + lhs4 >> rhs11; // NON_COMPLIANT: lhs4's precision is not strictly greater than + // rhs11 + lhs4 >> rhs12; // NON_COMPLIANT: lhs4's precision is not strictly greater than + // rhs12 + lhs4 >> rhs13; // NON_COMPLIANT: lhs4's precision is not strictly greater than + // rhs13 + lhs4 >> rhs14; // NON_COMPLIANT: lhs4's precision is not strictly greater than + // rhs14 + lhs5 >> rhs0; // COMPLIANT: lhs5's precision is strictly greater than rhs0 + lhs5 >> rhs1; // COMPLIANT: lhs5's precision is strictly greater than rhs1 + lhs5 >> rhs2; // COMPLIANT: lhs5's precision is strictly greater than rhs2 + lhs5 >> + rhs3; // NON_COMPLIANT: lhs5's precision is not strictly greater than rhs3 + lhs5 >> + rhs4; // NON_COMPLIANT: lhs5's precision is not strictly greater than rhs4 + lhs5 >> + rhs5; // NON_COMPLIANT: lhs5's precision is not strictly greater than rhs5 + lhs5 >> + rhs6; // NON_COMPLIANT: lhs5's precision is not strictly greater than rhs6 + lhs5 >> + rhs7; // NON_COMPLIANT: lhs5's precision is not strictly greater than rhs7 + lhs5 >> + rhs8; // NON_COMPLIANT: lhs5's precision is not strictly greater than rhs8 + lhs5 >> + rhs9; // NON_COMPLIANT: lhs5's precision is not strictly greater than rhs9 + lhs5 >> rhs10; // NON_COMPLIANT: lhs5's precision is not strictly greater than + // rhs10 + lhs5 >> rhs11; // NON_COMPLIANT: lhs5's precision is not strictly greater than + // rhs11 + lhs5 >> rhs12; // NON_COMPLIANT: lhs5's precision is not strictly greater than + // rhs12 + lhs5 >> rhs13; // NON_COMPLIANT: lhs5's precision is not strictly greater than + // rhs13 + lhs5 >> rhs14; // NON_COMPLIANT: lhs5's precision is not strictly greater than + // rhs14 + lhs6 >> rhs0; // COMPLIANT: lhs6's precision is strictly greater than rhs0 + lhs6 >> rhs1; // COMPLIANT: lhs6's precision is strictly greater than rhs1 + lhs6 >> rhs2; // COMPLIANT: lhs6's precision is strictly greater than rhs2 + lhs6 >> rhs3; // COMPLIANT: lhs6's precision is strictly greater than rhs3 + lhs6 >> rhs4; // COMPLIANT: lhs6's precision is strictly greater than rhs4 + lhs6 >> rhs5; // COMPLIANT: lhs6's precision is strictly greater than rhs5 + lhs6 >> + rhs6; // NON_COMPLIANT: lhs6's precision is not strictly greater than rhs6 + lhs6 >> rhs7; // COMPLIANT: lhs6's precision is strictly greater than rhs7 + lhs6 >> rhs8; // COMPLIANT: lhs6's precision is strictly greater than rhs8 + lhs6 >> + rhs9; // NON_COMPLIANT: lhs6's precision is not strictly greater than rhs9 + lhs6 >> rhs10; // COMPLIANT: lhs6's precision is strictly greater than rhs10 + lhs6 >> rhs11; // COMPLIANT: lhs6's precision is strictly greater than rhs11 + lhs6 >> rhs12; // NON_COMPLIANT: lhs6's precision is not strictly greater than + // rhs12 + lhs6 >> rhs13; // NON_COMPLIANT: lhs6's precision is not strictly greater than + // rhs13 + lhs6 >> rhs14; // NON_COMPLIANT: lhs6's precision is not strictly greater than + // rhs14 + lhs7 >> rhs0; // COMPLIANT: lhs7's precision is strictly greater than rhs0 + lhs7 >> rhs1; // COMPLIANT: lhs7's precision is strictly greater than rhs1 + lhs7 >> rhs2; // COMPLIANT: lhs7's precision is strictly greater than rhs2 + lhs7 >> rhs3; // COMPLIANT: lhs7's precision is strictly greater than rhs3 + lhs7 >> rhs4; // COMPLIANT: lhs7's precision is strictly greater than rhs4 + lhs7 >> rhs5; // COMPLIANT: lhs7's precision is strictly greater than rhs5 + lhs7 >> + rhs6; // NON_COMPLIANT: lhs7's precision is not strictly greater than rhs6 + lhs7 >> + rhs7; // NON_COMPLIANT: lhs7's precision is not strictly greater than rhs7 + lhs7 >> + rhs8; // NON_COMPLIANT: lhs7's precision is not strictly greater than rhs8 + lhs7 >> + rhs9; // NON_COMPLIANT: lhs7's precision is not strictly greater than rhs9 + lhs7 >> rhs10; // NON_COMPLIANT: lhs7's precision is not strictly greater than + // rhs10 + lhs7 >> rhs11; // NON_COMPLIANT: lhs7's precision is not strictly greater than + // rhs11 + lhs7 >> rhs12; // NON_COMPLIANT: lhs7's precision is not strictly greater than + // rhs12 + lhs7 >> rhs13; // NON_COMPLIANT: lhs7's precision is not strictly greater than + // rhs13 + lhs7 >> rhs14; // NON_COMPLIANT: lhs7's precision is not strictly greater than + // rhs14 + lhs8 >> rhs0; // COMPLIANT: lhs8's precision is strictly greater than rhs0 + lhs8 >> rhs1; // COMPLIANT: lhs8's precision is strictly greater than rhs1 + lhs8 >> rhs2; // COMPLIANT: lhs8's precision is strictly greater than rhs2 + lhs8 >> rhs3; // COMPLIANT: lhs8's precision is strictly greater than rhs3 + lhs8 >> rhs4; // COMPLIANT: lhs8's precision is strictly greater than rhs4 + lhs8 >> rhs5; // COMPLIANT: lhs8's precision is strictly greater than rhs5 + lhs8 >> + rhs6; // NON_COMPLIANT: lhs8's precision is not strictly greater than rhs6 + lhs8 >> + rhs7; // NON_COMPLIANT: lhs8's precision is not strictly greater than rhs7 + lhs8 >> + rhs8; // NON_COMPLIANT: lhs8's precision is not strictly greater than rhs8 + lhs8 >> + rhs9; // NON_COMPLIANT: lhs8's precision is not strictly greater than rhs9 + lhs8 >> rhs10; // NON_COMPLIANT: lhs8's precision is not strictly greater than + // rhs10 + lhs8 >> rhs11; // NON_COMPLIANT: lhs8's precision is not strictly greater than + // rhs11 + lhs8 >> rhs12; // NON_COMPLIANT: lhs8's precision is not strictly greater than + // rhs12 + lhs8 >> rhs13; // NON_COMPLIANT: lhs8's precision is not strictly greater than + // rhs13 + lhs8 >> rhs14; // NON_COMPLIANT: lhs8's precision is not strictly greater than + // rhs14 + lhs9 >> rhs0; // COMPLIANT: lhs9's precision is strictly greater than rhs0 + lhs9 >> rhs1; // COMPLIANT: lhs9's precision is strictly greater than rhs1 + lhs9 >> rhs2; // COMPLIANT: lhs9's precision is strictly greater than rhs2 + lhs9 >> rhs3; // COMPLIANT: lhs9's precision is strictly greater than rhs3 + lhs9 >> rhs4; // COMPLIANT: lhs9's precision is strictly greater than rhs4 + lhs9 >> rhs5; // COMPLIANT: lhs9's precision is strictly greater than rhs5 + lhs9 >> + rhs6; // NON_COMPLIANT: lhs9's precision is not strictly greater than rhs6 + lhs9 >> rhs7; // COMPLIANT: lhs9's precision is strictly greater than rhs7 + lhs9 >> rhs8; // COMPLIANT: lhs9's precision is strictly greater than rhs8 + lhs9 >> + rhs9; // NON_COMPLIANT: lhs9's precision is not strictly greater than rhs9 + lhs9 >> rhs10; // COMPLIANT: lhs9's precision is strictly greater than rhs10 + lhs9 >> rhs11; // COMPLIANT: lhs9's precision is strictly greater than rhs11 + lhs9 >> rhs12; // NON_COMPLIANT: lhs9's precision is not strictly greater than + // rhs12 + lhs9 >> rhs13; // NON_COMPLIANT: lhs9's precision is not strictly greater than + // rhs13 + lhs9 >> rhs14; // NON_COMPLIANT: lhs9's precision is not strictly greater than + // rhs14 + lhs10 >> rhs0; // COMPLIANT: lhs10's precision is strictly greater than rhs0 + lhs10 >> rhs1; // COMPLIANT: lhs10's precision is strictly greater than rhs1 + lhs10 >> rhs2; // COMPLIANT: lhs10's precision is strictly greater than rhs2 + lhs10 >> rhs3; // COMPLIANT: lhs10's precision is strictly greater than rhs3 + lhs10 >> rhs4; // COMPLIANT: lhs10's precision is strictly greater than rhs4 + lhs10 >> rhs5; // COMPLIANT: lhs10's precision is strictly greater than rhs5 + lhs10 >> rhs6; // NON_COMPLIANT: lhs10's precision is not strictly greater + // than rhs6 + lhs10 >> rhs7; // NON_COMPLIANT: lhs10's precision is not strictly greater + // than rhs7 + lhs10 >> rhs8; // NON_COMPLIANT: lhs10's precision is not strictly greater + // than rhs8 + lhs10 >> rhs9; // NON_COMPLIANT: lhs10's precision is not strictly greater + // than rhs9 + lhs10 >> rhs10; // NON_COMPLIANT: lhs10's precision is not strictly greater + // than rhs10 + lhs10 >> rhs11; // NON_COMPLIANT: lhs10's precision is not strictly greater + // than rhs11 + lhs10 >> rhs12; // NON_COMPLIANT: lhs10's precision is not strictly greater + // than rhs12 + lhs10 >> rhs13; // NON_COMPLIANT: lhs10's precision is not strictly greater + // than rhs13 + lhs10 >> rhs14; // NON_COMPLIANT: lhs10's precision is not strictly greater + // than rhs14 + lhs11 >> rhs0; // COMPLIANT: lhs11's precision is strictly greater than rhs0 + lhs11 >> rhs1; // COMPLIANT: lhs11's precision is strictly greater than rhs1 + lhs11 >> rhs2; // COMPLIANT: lhs11's precision is strictly greater than rhs2 + lhs11 >> rhs3; // COMPLIANT: lhs11's precision is strictly greater than rhs3 + lhs11 >> rhs4; // COMPLIANT: lhs11's precision is strictly greater than rhs4 + lhs11 >> rhs5; // COMPLIANT: lhs11's precision is strictly greater than rhs5 + lhs11 >> rhs6; // NON_COMPLIANT: lhs11's precision is not strictly greater + // than rhs6 + lhs11 >> rhs7; // NON_COMPLIANT: lhs11's precision is not strictly greater + // than rhs7 + lhs11 >> rhs8; // NON_COMPLIANT: lhs11's precision is not strictly greater + // than rhs8 + lhs11 >> rhs9; // NON_COMPLIANT: lhs11's precision is not strictly greater + // than rhs9 + lhs11 >> rhs10; // NON_COMPLIANT: lhs11's precision is not strictly greater + // than rhs10 + lhs11 >> rhs11; // NON_COMPLIANT: lhs11's precision is not strictly greater + // than rhs11 + lhs11 >> rhs12; // NON_COMPLIANT: lhs11's precision is not strictly greater + // than rhs12 + lhs11 >> rhs13; // NON_COMPLIANT: lhs11's precision is not strictly greater + // than rhs13 + lhs11 >> rhs14; // NON_COMPLIANT: lhs11's precision is not strictly greater + // than rhs14 + lhs12 >> rhs0; // COMPLIANT: lhs12's precision is strictly greater than rhs0 + lhs12 >> rhs1; // COMPLIANT: lhs12's precision is strictly greater than rhs1 + lhs12 >> rhs2; // COMPLIANT: lhs12's precision is strictly greater than rhs2 + lhs12 >> rhs3; // COMPLIANT: lhs12's precision is strictly greater than rhs3 + lhs12 >> rhs4; // COMPLIANT: lhs12's precision is strictly greater than rhs4 + lhs12 >> rhs5; // COMPLIANT: lhs12's precision is strictly greater than rhs5 + lhs12 >> rhs6; // COMPLIANT: lhs12's precision is strictly greater than rhs6 + lhs12 >> rhs7; // COMPLIANT: lhs12's precision is strictly greater than rhs7 + lhs12 >> rhs8; // COMPLIANT: lhs12's precision is strictly greater than rhs8 + lhs12 >> rhs9; // COMPLIANT: lhs12's precision is strictly greater than rhs9 + lhs12 >> rhs10; // COMPLIANT: lhs12's precision is strictly greater than rhs10 + lhs12 >> rhs11; // COMPLIANT: lhs12's precision is strictly greater than rhs11 + lhs12 >> rhs12; // NON_COMPLIANT: lhs12's precision is not strictly greater + // than rhs12 + lhs12 >> rhs13; // COMPLIANT: lhs12's precision is strictly greater than rhs13 + lhs12 >> rhs14; // COMPLIANT: lhs12's precision is strictly greater than rhs14 + lhs13 >> rhs0; // COMPLIANT: lhs13's precision is strictly greater than rhs0 + lhs13 >> rhs1; // COMPLIANT: lhs13's precision is strictly greater than rhs1 + lhs13 >> rhs2; // COMPLIANT: lhs13's precision is strictly greater than rhs2 + lhs13 >> rhs3; // COMPLIANT: lhs13's precision is strictly greater than rhs3 + lhs13 >> rhs4; // COMPLIANT: lhs13's precision is strictly greater than rhs4 + lhs13 >> rhs5; // COMPLIANT: lhs13's precision is strictly greater than rhs5 + lhs13 >> rhs6; // COMPLIANT: lhs13's precision is strictly greater than rhs6 + lhs13 >> rhs7; // COMPLIANT: lhs13's precision is strictly greater than rhs7 + lhs13 >> rhs8; // COMPLIANT: lhs13's precision is strictly greater than rhs8 + lhs13 >> rhs9; // COMPLIANT: lhs13's precision is strictly greater than rhs9 + lhs13 >> rhs10; // COMPLIANT: lhs13's precision is strictly greater than rhs10 + lhs13 >> rhs11; // COMPLIANT: lhs13's precision is strictly greater than rhs11 + lhs13 >> rhs12; // NON_COMPLIANT: lhs13's precision is not strictly greater + // than rhs12 + lhs13 >> rhs13; // NON_COMPLIANT: lhs13's precision is not strictly greater + // than rhs13 + lhs13 >> rhs14; // NON_COMPLIANT: lhs13's precision is not strictly greater + // than rhs14 + lhs14 >> rhs0; // COMPLIANT: lhs14's precision is strictly greater than rhs0 + lhs14 >> rhs1; // COMPLIANT: lhs14's precision is strictly greater than rhs1 + lhs14 >> rhs2; // COMPLIANT: lhs14's precision is strictly greater than rhs2 + lhs14 >> rhs3; // COMPLIANT: lhs14's precision is strictly greater than rhs3 + lhs14 >> rhs4; // COMPLIANT: lhs14's precision is strictly greater than rhs4 + lhs14 >> rhs5; // COMPLIANT: lhs14's precision is strictly greater than rhs5 + lhs14 >> rhs6; // COMPLIANT: lhs14's precision is strictly greater than rhs6 + lhs14 >> rhs7; // COMPLIANT: lhs14's precision is strictly greater than rhs7 + lhs14 >> rhs8; // COMPLIANT: lhs14's precision is strictly greater than rhs8 + lhs14 >> rhs9; // COMPLIANT: lhs14's precision is strictly greater than rhs9 + lhs14 >> rhs10; // COMPLIANT: lhs14's precision is strictly greater than rhs10 + lhs14 >> rhs11; // COMPLIANT: lhs14's precision is strictly greater than rhs11 + lhs14 >> rhs12; // NON_COMPLIANT: lhs14's precision is not strictly greater + // than rhs12 + lhs14 >> rhs13; // NON_COMPLIANT: lhs14's precision is not strictly greater + // than rhs13 + lhs14 >> rhs14; // NON_COMPLIANT: lhs14's precision is not strictly greater + // than rhs14 - /* left shift */ + /* ===== Right shift with guards, the shift expression is at `then` branch + * ===== */ - x0 << x0; // NON_COMPLIANT: x0's precision is not strictly greater than x0's - x0 << x1; // COMPLIANT: x0's precision is strictly greater than x1's - x0 << x2; // COMPLIANT: x0's precision is strictly greater than x2's - x0 << x3; // NON_COMPLIANT: x0's precision is not strictly greater than x3's - x0 << x4; // NON_COMPLIANT: x0's precision is not strictly greater than x4's - x0 << x5; // NON_COMPLIANT: x0's precision is not strictly greater than x5's - x0 << x6; // NON_COMPLIANT: x0's precision is not strictly greater than x6's - x0 << x7; // NON_COMPLIANT: x0's precision is not strictly greater than x7's - x0 << x8; // NON_COMPLIANT: x0's precision is not strictly greater than x8's - x0 << x9; // NON_COMPLIANT: x0's precision is not strictly greater than x9's - x0 << x10; // NON_COMPLIANT: x0's precision is not strictly greater than x10's - x0 << x11; // NON_COMPLIANT: x0's precision is not strictly greater than x11's - x0 << x12; // NON_COMPLIANT: x0's precision is not strictly greater than x12's - x0 << x13; // NON_COMPLIANT: x0's precision is not strictly greater than x13's - x0 << x14; // NON_COMPLIANT: x0's precision is not strictly greater than x14's - x1 << x0; // NON_COMPLIANT: x1's precision is not strictly greater than x0's - x1 << x1; // NON_COMPLIANT: x1's precision is not strictly greater than x1's - x1 << x2; // NON_COMPLIANT: x1's precision is not strictly greater than x2's - x1 << x3; // NON_COMPLIANT: x1's precision is not strictly greater than x3's - x1 << x4; // NON_COMPLIANT: x1's precision is not strictly greater than x4's - x1 << x5; // NON_COMPLIANT: x1's precision is not strictly greater than x5's - x1 << x6; // NON_COMPLIANT: x1's precision is not strictly greater than x6's - x1 << x7; // NON_COMPLIANT: x1's precision is not strictly greater than x7's - x1 << x8; // NON_COMPLIANT: x1's precision is not strictly greater than x8's - x1 << x9; // NON_COMPLIANT: x1's precision is not strictly greater than x9's - x1 << x10; // NON_COMPLIANT: x1's precision is not strictly greater than x10's - x1 << x11; // NON_COMPLIANT: x1's precision is not strictly greater than x11's - x1 << x12; // NON_COMPLIANT: x1's precision is not strictly greater than x12's - x1 << x13; // NON_COMPLIANT: x1's precision is not strictly greater than x13's - x1 << x14; // NON_COMPLIANT: x1's precision is not strictly greater than x14's - x2 << x0; // NON_COMPLIANT: x2's precision is not strictly greater than x0's - x2 << x1; // NON_COMPLIANT: x2's precision is not strictly greater than x1's - x2 << x2; // NON_COMPLIANT: x2's precision is not strictly greater than x2's - x2 << x3; // NON_COMPLIANT: x2's precision is not strictly greater than x3's - x2 << x4; // NON_COMPLIANT: x2's precision is not strictly greater than x4's - x2 << x5; // NON_COMPLIANT: x2's precision is not strictly greater than x5's - x2 << x6; // NON_COMPLIANT: x2's precision is not strictly greater than x6's - x2 << x7; // NON_COMPLIANT: x2's precision is not strictly greater than x7's - x2 << x8; // NON_COMPLIANT: x2's precision is not strictly greater than x8's - x2 << x9; // NON_COMPLIANT: x2's precision is not strictly greater than x9's - x2 << x10; // NON_COMPLIANT: x2's precision is not strictly greater than x10's - x2 << x11; // NON_COMPLIANT: x2's precision is not strictly greater than x11's - x2 << x12; // NON_COMPLIANT: x2's precision is not strictly greater than x12's - x2 << x13; // NON_COMPLIANT: x2's precision is not strictly greater than x13's - x2 << x14; // NON_COMPLIANT: x2's precision is not strictly greater than x14's - x3 << x0; // COMPLIANT: x3's precision is strictly greater than x0's - x3 << x1; // COMPLIANT: x3's precision is strictly greater than x1's - x3 << x2; // COMPLIANT: x3's precision is strictly greater than x2's - x3 << x3; // NON_COMPLIANT: x3's precision is not strictly greater than x3's - x3 << x4; // COMPLIANT: x3's precision is strictly greater than x4's - x3 << x5; // COMPLIANT: x3's precision is strictly greater than x5's - x3 << x6; // NON_COMPLIANT: x3's precision is not strictly greater than x6's - x3 << x7; // NON_COMPLIANT: x3's precision is not strictly greater than x7's - x3 << x8; // NON_COMPLIANT: x3's precision is not strictly greater than x8's - x3 << x9; // NON_COMPLIANT: x3's precision is not strictly greater than x9's - x3 << x10; // NON_COMPLIANT: x3's precision is not strictly greater than x10's - x3 << x11; // NON_COMPLIANT: x3's precision is not strictly greater than x11's - x3 << x12; // NON_COMPLIANT: x3's precision is not strictly greater than x12's - x3 << x13; // NON_COMPLIANT: x3's precision is not strictly greater than x13's - x3 << x14; // NON_COMPLIANT: x3's precision is not strictly greater than x14's - x4 << x0; // COMPLIANT: x4's precision is strictly greater than x0's - x4 << x1; // COMPLIANT: x4's precision is strictly greater than x1's - x4 << x2; // COMPLIANT: x4's precision is strictly greater than x2's - x4 << x3; // NON_COMPLIANT: x4's precision is not strictly greater than x3's - x4 << x4; // NON_COMPLIANT: x4's precision is not strictly greater than x4's - x4 << x5; // NON_COMPLIANT: x4's precision is not strictly greater than x5's - x4 << x6; // NON_COMPLIANT: x4's precision is not strictly greater than x6's - x4 << x7; // NON_COMPLIANT: x4's precision is not strictly greater than x7's - x4 << x8; // NON_COMPLIANT: x4's precision is not strictly greater than x8's - x4 << x9; // NON_COMPLIANT: x4's precision is not strictly greater than x9's - x4 << x10; // NON_COMPLIANT: x4's precision is not strictly greater than x10's - x4 << x11; // NON_COMPLIANT: x4's precision is not strictly greater than x11's - x4 << x12; // NON_COMPLIANT: x4's precision is not strictly greater than x12's - x4 << x13; // NON_COMPLIANT: x4's precision is not strictly greater than x13's - x4 << x14; // NON_COMPLIANT: x4's precision is not strictly greater than x14's - x5 << x0; // COMPLIANT: x5's precision is strictly greater than x0's - x5 << x1; // COMPLIANT: x5's precision is strictly greater than x1's - x5 << x2; // COMPLIANT: x5's precision is strictly greater than x2's - x5 << x3; // NON_COMPLIANT: x5's precision is not strictly greater than x3's - x5 << x4; // NON_COMPLIANT: x5's precision is not strictly greater than x4's - x5 << x5; // NON_COMPLIANT: x5's precision is not strictly greater than x5's - x5 << x6; // NON_COMPLIANT: x5's precision is not strictly greater than x6's - x5 << x7; // NON_COMPLIANT: x5's precision is not strictly greater than x7's - x5 << x8; // NON_COMPLIANT: x5's precision is not strictly greater than x8's - x5 << x9; // NON_COMPLIANT: x5's precision is not strictly greater than x9's - x5 << x10; // NON_COMPLIANT: x5's precision is not strictly greater than x10's - x5 << x11; // NON_COMPLIANT: x5's precision is not strictly greater than x11's - x5 << x12; // NON_COMPLIANT: x5's precision is not strictly greater than x12's - x5 << x13; // NON_COMPLIANT: x5's precision is not strictly greater than x13's - x5 << x14; // NON_COMPLIANT: x5's precision is not strictly greater than x14's - x6 << x0; // COMPLIANT: x6's precision is strictly greater than x0's - x6 << x1; // COMPLIANT: x6's precision is strictly greater than x1's - x6 << x2; // COMPLIANT: x6's precision is strictly greater than x2's - x6 << x3; // COMPLIANT: x6's precision is strictly greater than x3's - x6 << x4; // COMPLIANT: x6's precision is strictly greater than x4's - x6 << x5; // COMPLIANT: x6's precision is strictly greater than x5's - x6 << x6; // NON_COMPLIANT: x6's precision is not strictly greater than x6's - x6 << x7; // COMPLIANT: x6's precision is strictly greater than x7's - x6 << x8; // COMPLIANT: x6's precision is strictly greater than x8's - x6 << x9; // NON_COMPLIANT: x6's precision is not strictly greater than x9's - x6 << x10; // COMPLIANT: x6's precision is strictly greater than x10's - x6 << x11; // COMPLIANT: x6's precision is strictly greater than x11's - x6 << x12; // NON_COMPLIANT: x6's precision is not strictly greater than x12's - x6 << x13; // NON_COMPLIANT: x6's precision is not strictly greater than x13's - x6 << x14; // NON_COMPLIANT: x6's precision is not strictly greater than x14's - x7 << x0; // COMPLIANT: x7's precision is strictly greater than x0's - x7 << x1; // COMPLIANT: x7's precision is strictly greater than x1's - x7 << x2; // COMPLIANT: x7's precision is strictly greater than x2's - x7 << x3; // COMPLIANT: x7's precision is strictly greater than x3's - x7 << x4; // COMPLIANT: x7's precision is strictly greater than x4's - x7 << x5; // COMPLIANT: x7's precision is strictly greater than x5's - x7 << x6; // NON_COMPLIANT: x7's precision is not strictly greater than x6's - x7 << x7; // NON_COMPLIANT: x7's precision is not strictly greater than x7's - x7 << x8; // NON_COMPLIANT: x7's precision is not strictly greater than x8's - x7 << x9; // NON_COMPLIANT: x7's precision is not strictly greater than x9's - x7 << x10; // NON_COMPLIANT: x7's precision is not strictly greater than x10's - x7 << x11; // NON_COMPLIANT: x7's precision is not strictly greater than x11's - x7 << x12; // NON_COMPLIANT: x7's precision is not strictly greater than x12's - x7 << x13; // NON_COMPLIANT: x7's precision is not strictly greater than x13's - x7 << x14; // NON_COMPLIANT: x7's precision is not strictly greater than x14's - x8 << x0; // COMPLIANT: x8's precision is strictly greater than x0's - x8 << x1; // COMPLIANT: x8's precision is strictly greater than x1's - x8 << x2; // COMPLIANT: x8's precision is strictly greater than x2's - x8 << x3; // COMPLIANT: x8's precision is strictly greater than x3's - x8 << x4; // COMPLIANT: x8's precision is strictly greater than x4's - x8 << x5; // COMPLIANT: x8's precision is strictly greater than x5's - x8 << x6; // NON_COMPLIANT: x8's precision is not strictly greater than x6's - x8 << x7; // NON_COMPLIANT: x8's precision is not strictly greater than x7's - x8 << x8; // NON_COMPLIANT: x8's precision is not strictly greater than x8's - x8 << x9; // NON_COMPLIANT: x8's precision is not strictly greater than x9's - x8 << x10; // NON_COMPLIANT: x8's precision is not strictly greater than x10's - x8 << x11; // NON_COMPLIANT: x8's precision is not strictly greater than x11's - x8 << x12; // NON_COMPLIANT: x8's precision is not strictly greater than x12's - x8 << x13; // NON_COMPLIANT: x8's precision is not strictly greater than x13's - x8 << x14; // NON_COMPLIANT: x8's precision is not strictly greater than x14's - x9 << x0; // COMPLIANT: x9's precision is strictly greater than x0's - x9 << x1; // COMPLIANT: x9's precision is strictly greater than x1's - x9 << x2; // COMPLIANT: x9's precision is strictly greater than x2's - x9 << x3; // COMPLIANT: x9's precision is strictly greater than x3's - x9 << x4; // COMPLIANT: x9's precision is strictly greater than x4's - x9 << x5; // COMPLIANT: x9's precision is strictly greater than x5's - x9 << x6; // NON_COMPLIANT: x9's precision is not strictly greater than x6's - x9 << x7; // COMPLIANT: x9's precision is strictly greater than x7's - x9 << x8; // COMPLIANT: x9's precision is strictly greater than x8's - x9 << x9; // NON_COMPLIANT: x9's precision is not strictly greater than x9's - x9 << x10; // COMPLIANT: x9's precision is strictly greater than x10's - x9 << x11; // COMPLIANT: x9's precision is strictly greater than x11's - x9 << x12; // NON_COMPLIANT: x9's precision is not strictly greater than x12's - x9 << x13; // NON_COMPLIANT: x9's precision is not strictly greater than x13's - x9 << x14; // NON_COMPLIANT: x9's precision is not strictly greater than x14's - x10 << x0; // COMPLIANT: x10's precision is strictly greater than x0's - x10 << x1; // COMPLIANT: x10's precision is strictly greater than x1's - x10 << x2; // COMPLIANT: x10's precision is strictly greater than x2's - x10 << x3; // COMPLIANT: x10's precision is strictly greater than x3's - x10 << x4; // COMPLIANT: x10's precision is strictly greater than x4's - x10 << x5; // COMPLIANT: x10's precision is strictly greater than x5's - x10 << x6; // NON_COMPLIANT: x10's precision is not strictly greater than x6's - x10 << x7; // NON_COMPLIANT: x10's precision is not strictly greater than x7's - x10 << x8; // NON_COMPLIANT: x10's precision is not strictly greater than x8's - x10 << x9; // NON_COMPLIANT: x10's precision is not strictly greater than x9's - x10 << x10; // NON_COMPLIANT: x10's precision is not strictly greater than - // x10's - x10 << x11; // NON_COMPLIANT: x10's precision is not strictly greater than - // x11's - x10 << x12; // NON_COMPLIANT: x10's precision is not strictly greater than - // x12's - x10 << x13; // NON_COMPLIANT: x10's precision is not strictly greater than - // x13's - x10 << x14; // NON_COMPLIANT: x10's precision is not strictly greater than - // x14's - x11 << x0; // COMPLIANT: x11's precision is strictly greater than x0's - x11 << x1; // COMPLIANT: x11's precision is strictly greater than x1's - x11 << x2; // COMPLIANT: x11's precision is strictly greater than x2's - x11 << x3; // COMPLIANT: x11's precision is strictly greater than x3's - x11 << x4; // COMPLIANT: x11's precision is strictly greater than x4's - x11 << x5; // COMPLIANT: x11's precision is strictly greater than x5's - x11 << x6; // NON_COMPLIANT: x11's precision is not strictly greater than x6's - x11 << x7; // NON_COMPLIANT: x11's precision is not strictly greater than x7's - x11 << x8; // NON_COMPLIANT: x11's precision is not strictly greater than x8's - x11 << x9; // NON_COMPLIANT: x11's precision is not strictly greater than x9's - x11 << x10; // NON_COMPLIANT: x11's precision is not strictly greater than - // x10's - x11 << x11; // NON_COMPLIANT: x11's precision is not strictly greater than - // x11's - x11 << x12; // NON_COMPLIANT: x11's precision is not strictly greater than - // x12's - x11 << x13; // NON_COMPLIANT: x11's precision is not strictly greater than - // x13's - x11 << x14; // NON_COMPLIANT: x11's precision is not strictly greater than - // x14's - x12 << x0; // COMPLIANT: x12's precision is strictly greater than x0's - x12 << x1; // COMPLIANT: x12's precision is strictly greater than x1's - x12 << x2; // COMPLIANT: x12's precision is strictly greater than x2's - x12 << x3; // COMPLIANT: x12's precision is strictly greater than x3's - x12 << x4; // COMPLIANT: x12's precision is strictly greater than x4's - x12 << x5; // COMPLIANT: x12's precision is strictly greater than x5's - x12 << x6; // COMPLIANT: x12's precision is strictly greater than x6's - x12 << x7; // COMPLIANT: x12's precision is strictly greater than x7's - x12 << x8; // COMPLIANT: x12's precision is strictly greater than x8's - x12 << x9; // COMPLIANT: x12's precision is strictly greater than x9's - x12 << x10; // COMPLIANT: x12's precision is strictly greater than x10's - x12 << x11; // COMPLIANT: x12's precision is strictly greater than x11's - x12 << x12; // NON_COMPLIANT: x12's precision is not strictly greater than - // x12's - x12 << x13; // COMPLIANT: x12's precision is strictly greater than x13's - x12 << x14; // COMPLIANT: x12's precision is strictly greater than x14's - x13 << x0; // COMPLIANT: x13's precision is strictly greater than x0's - x13 << x1; // COMPLIANT: x13's precision is strictly greater than x1's - x13 << x2; // COMPLIANT: x13's precision is strictly greater than x2's - x13 << x3; // COMPLIANT: x13's precision is strictly greater than x3's - x13 << x4; // COMPLIANT: x13's precision is strictly greater than x4's - x13 << x5; // COMPLIANT: x13's precision is strictly greater than x5's - x13 << x6; // COMPLIANT: x13's precision is strictly greater than x6's - x13 << x7; // COMPLIANT: x13's precision is strictly greater than x7's - x13 << x8; // COMPLIANT: x13's precision is strictly greater than x8's - x13 << x9; // COMPLIANT: x13's precision is strictly greater than x9's - x13 << x10; // COMPLIANT: x13's precision is strictly greater than x10's - x13 << x11; // COMPLIANT: x13's precision is strictly greater than x11's - x13 << x12; // NON_COMPLIANT: x13's precision is not strictly greater than - // x12's - x13 << x13; // NON_COMPLIANT: x13's precision is not strictly greater than - // x13's - x13 << x14; // NON_COMPLIANT: x13's precision is not strictly greater than - // x14's - x14 << x0; // COMPLIANT: x14's precision is strictly greater than x0's - x14 << x1; // COMPLIANT: x14's precision is strictly greater than x1's - x14 << x2; // COMPLIANT: x14's precision is strictly greater than x2's - x14 << x3; // COMPLIANT: x14's precision is strictly greater than x3's - x14 << x4; // COMPLIANT: x14's precision is strictly greater than x4's - x14 << x5; // COMPLIANT: x14's precision is strictly greater than x5's - x14 << x6; // COMPLIANT: x14's precision is strictly greater than x6's - x14 << x7; // COMPLIANT: x14's precision is strictly greater than x7's - x14 << x8; // COMPLIANT: x14's precision is strictly greater than x8's - x14 << x9; // COMPLIANT: x14's precision is strictly greater than x9's - x14 << x10; // COMPLIANT: x14's precision is strictly greater than x10's - x14 << x11; // COMPLIANT: x14's precision is strictly greater than x11's - x14 << x12; // NON_COMPLIANT: x14's precision is not strictly greater than - // x12's - x14 << x13; // NON_COMPLIANT: x14's precision is not strictly greater than - // x13's - x14 << x14; // NON_COMPLIANT: x14's precision is not strictly greater than - // x14's + if (rhs0 < PRECISION(UCHAR_MAX)) + lhs0 >> rhs0; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs0, but it's inside a PRECISION guard + if (rhs3 < PRECISION(UCHAR_MAX)) + lhs0 >> rhs3; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs3, but it's inside a PRECISION guard + if (rhs4 < PRECISION(UCHAR_MAX)) + lhs0 >> rhs4; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs4, but it's inside a PRECISION guard + if (rhs5 < PRECISION(UCHAR_MAX)) + lhs0 >> rhs5; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs5, but it's inside a PRECISION guard + if (rhs6 < PRECISION(UCHAR_MAX)) + lhs0 >> rhs6; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + if (rhs7 < PRECISION(UCHAR_MAX)) + lhs0 >> rhs7; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + if (rhs8 < PRECISION(UCHAR_MAX)) + lhs0 >> rhs8; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + if (rhs9 < PRECISION(UCHAR_MAX)) + lhs0 >> rhs9; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + if (rhs10 < PRECISION(UCHAR_MAX)) + lhs0 >> rhs10; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + if (rhs11 < PRECISION(UCHAR_MAX)) + lhs0 >> rhs11; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + if (rhs12 < PRECISION(UCHAR_MAX)) + lhs0 >> rhs12; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(UCHAR_MAX)) + lhs0 >> rhs13; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(UCHAR_MAX)) + lhs0 >> rhs14; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + if (rhs0 < PRECISION(CHAR_MAX)) + lhs1 >> rhs0; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs0, but it's inside a PRECISION guard + if (rhs1 < PRECISION(CHAR_MAX)) + lhs1 >> rhs1; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs1, but it's inside a PRECISION guard + if (rhs2 < PRECISION(CHAR_MAX)) + lhs1 >> rhs2; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs2, but it's inside a PRECISION guard + if (rhs3 < PRECISION(CHAR_MAX)) + lhs1 >> rhs3; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs3, but it's inside a PRECISION guard + if (rhs4 < PRECISION(CHAR_MAX)) + lhs1 >> rhs4; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs4, but it's inside a PRECISION guard + if (rhs5 < PRECISION(CHAR_MAX)) + lhs1 >> rhs5; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs5, but it's inside a PRECISION guard + if (rhs6 < PRECISION(CHAR_MAX)) + lhs1 >> rhs6; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + if (rhs7 < PRECISION(CHAR_MAX)) + lhs1 >> rhs7; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + if (rhs8 < PRECISION(CHAR_MAX)) + lhs1 >> rhs8; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + if (rhs9 < PRECISION(CHAR_MAX)) + lhs1 >> rhs9; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + if (rhs10 < PRECISION(CHAR_MAX)) + lhs1 >> rhs10; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + if (rhs11 < PRECISION(CHAR_MAX)) + lhs1 >> rhs11; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + if (rhs12 < PRECISION(CHAR_MAX)) + lhs1 >> rhs12; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(CHAR_MAX)) + lhs1 >> rhs13; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(CHAR_MAX)) + lhs1 >> rhs14; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + if (rhs0 < PRECISION(CHAR_MAX)) + lhs2 >> rhs0; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs0, but it's inside a PRECISION guard + if (rhs1 < PRECISION(CHAR_MAX)) + lhs2 >> rhs1; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs1, but it's inside a PRECISION guard + if (rhs2 < PRECISION(CHAR_MAX)) + lhs2 >> rhs2; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs2, but it's inside a PRECISION guard + if (rhs3 < PRECISION(CHAR_MAX)) + lhs2 >> rhs3; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs3, but it's inside a PRECISION guard + if (rhs4 < PRECISION(CHAR_MAX)) + lhs2 >> rhs4; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs4, but it's inside a PRECISION guard + if (rhs5 < PRECISION(CHAR_MAX)) + lhs2 >> rhs5; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs5, but it's inside a PRECISION guard + if (rhs6 < PRECISION(CHAR_MAX)) + lhs2 >> rhs6; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + if (rhs7 < PRECISION(CHAR_MAX)) + lhs2 >> rhs7; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + if (rhs8 < PRECISION(CHAR_MAX)) + lhs2 >> rhs8; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + if (rhs9 < PRECISION(CHAR_MAX)) + lhs2 >> rhs9; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + if (rhs10 < PRECISION(CHAR_MAX)) + lhs2 >> rhs10; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + if (rhs11 < PRECISION(CHAR_MAX)) + lhs2 >> rhs11; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + if (rhs12 < PRECISION(CHAR_MAX)) + lhs2 >> rhs12; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(CHAR_MAX)) + lhs2 >> rhs13; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(CHAR_MAX)) + lhs2 >> rhs14; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + if (rhs3 < PRECISION(USHRT_MAX)) + lhs3 >> rhs3; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs3, but it's inside a PRECISION guard + if (rhs6 < PRECISION(USHRT_MAX)) + lhs3 >> rhs6; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + if (rhs7 < PRECISION(USHRT_MAX)) + lhs3 >> rhs7; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + if (rhs8 < PRECISION(USHRT_MAX)) + lhs3 >> rhs8; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + if (rhs9 < PRECISION(USHRT_MAX)) + lhs3 >> rhs9; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + if (rhs10 < PRECISION(USHRT_MAX)) + lhs3 >> rhs10; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + if (rhs11 < PRECISION(USHRT_MAX)) + lhs3 >> rhs11; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + if (rhs12 < PRECISION(USHRT_MAX)) + lhs3 >> rhs12; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(USHRT_MAX)) + lhs3 >> rhs13; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(USHRT_MAX)) + lhs3 >> rhs14; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + if (rhs3 < PRECISION(SHRT_MAX)) + lhs4 >> rhs3; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs3, but it's inside a PRECISION guard + if (rhs4 < PRECISION(SHRT_MAX)) + lhs4 >> rhs4; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs4, but it's inside a PRECISION guard + if (rhs5 < PRECISION(SHRT_MAX)) + lhs4 >> rhs5; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs5, but it's inside a PRECISION guard + if (rhs6 < PRECISION(SHRT_MAX)) + lhs4 >> rhs6; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + if (rhs7 < PRECISION(SHRT_MAX)) + lhs4 >> rhs7; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + if (rhs8 < PRECISION(SHRT_MAX)) + lhs4 >> rhs8; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + if (rhs9 < PRECISION(SHRT_MAX)) + lhs4 >> rhs9; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + if (rhs10 < PRECISION(SHRT_MAX)) + lhs4 >> rhs10; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + if (rhs11 < PRECISION(SHRT_MAX)) + lhs4 >> rhs11; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + if (rhs12 < PRECISION(SHRT_MAX)) + lhs4 >> rhs12; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(SHRT_MAX)) + lhs4 >> rhs13; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(SHRT_MAX)) + lhs4 >> rhs14; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + if (rhs3 < PRECISION(SHRT_MAX)) + lhs5 >> rhs3; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs3, but it's inside a PRECISION guard + if (rhs4 < PRECISION(SHRT_MAX)) + lhs5 >> rhs4; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs4, but it's inside a PRECISION guard + if (rhs5 < PRECISION(SHRT_MAX)) + lhs5 >> rhs5; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs5, but it's inside a PRECISION guard + if (rhs6 < PRECISION(SHRT_MAX)) + lhs5 >> rhs6; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + if (rhs7 < PRECISION(SHRT_MAX)) + lhs5 >> rhs7; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + if (rhs8 < PRECISION(SHRT_MAX)) + lhs5 >> rhs8; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + if (rhs9 < PRECISION(SHRT_MAX)) + lhs5 >> rhs9; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + if (rhs10 < PRECISION(SHRT_MAX)) + lhs5 >> rhs10; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + if (rhs11 < PRECISION(SHRT_MAX)) + lhs5 >> rhs11; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + if (rhs12 < PRECISION(SHRT_MAX)) + lhs5 >> rhs12; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(SHRT_MAX)) + lhs5 >> rhs13; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(SHRT_MAX)) + lhs5 >> rhs14; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + if (rhs6 < PRECISION(UINT_MAX)) + lhs6 >> rhs6; // COMPLIANT: lhs6's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + if (rhs9 < PRECISION(UINT_MAX)) + lhs6 >> rhs9; // COMPLIANT: lhs6's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + if (rhs12 < PRECISION(UINT_MAX)) + lhs6 >> rhs12; // COMPLIANT: lhs6's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(UINT_MAX)) + lhs6 >> rhs13; // COMPLIANT: lhs6's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(UINT_MAX)) + lhs6 >> rhs14; // COMPLIANT: lhs6's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + if (rhs6 < PRECISION(INT_MAX)) + lhs7 >> rhs6; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + if (rhs7 < PRECISION(INT_MAX)) + lhs7 >> rhs7; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + if (rhs8 < PRECISION(INT_MAX)) + lhs7 >> rhs8; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + if (rhs9 < PRECISION(INT_MAX)) + lhs7 >> rhs9; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + if (rhs10 < PRECISION(INT_MAX)) + lhs7 >> rhs10; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + if (rhs11 < PRECISION(INT_MAX)) + lhs7 >> rhs11; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + if (rhs12 < PRECISION(INT_MAX)) + lhs7 >> rhs12; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(INT_MAX)) + lhs7 >> rhs13; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(INT_MAX)) + lhs7 >> rhs14; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + if (rhs6 < PRECISION(INT_MAX)) + lhs8 >> rhs6; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + if (rhs7 < PRECISION(INT_MAX)) + lhs8 >> rhs7; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + if (rhs8 < PRECISION(INT_MAX)) + lhs8 >> rhs8; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + if (rhs9 < PRECISION(INT_MAX)) + lhs8 >> rhs9; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + if (rhs10 < PRECISION(INT_MAX)) + lhs8 >> rhs10; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + if (rhs11 < PRECISION(INT_MAX)) + lhs8 >> rhs11; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + if (rhs12 < PRECISION(INT_MAX)) + lhs8 >> rhs12; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(INT_MAX)) + lhs8 >> rhs13; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(INT_MAX)) + lhs8 >> rhs14; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + if (rhs6 < PRECISION(ULONG_MAX)) + lhs9 >> rhs6; // COMPLIANT: lhs9's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + if (rhs9 < PRECISION(ULONG_MAX)) + lhs9 >> rhs9; // COMPLIANT: lhs9's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + if (rhs12 < PRECISION(ULONG_MAX)) + lhs9 >> rhs12; // COMPLIANT: lhs9's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(ULONG_MAX)) + lhs9 >> rhs13; // COMPLIANT: lhs9's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(ULONG_MAX)) + lhs9 >> rhs14; // COMPLIANT: lhs9's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + if (rhs6 < PRECISION(LONG_MAX)) + lhs10 >> rhs6; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + if (rhs7 < PRECISION(LONG_MAX)) + lhs10 >> rhs7; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + if (rhs8 < PRECISION(LONG_MAX)) + lhs10 >> rhs8; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + if (rhs9 < PRECISION(LONG_MAX)) + lhs10 >> rhs9; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + if (rhs10 < PRECISION(LONG_MAX)) + lhs10 >> rhs10; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + if (rhs11 < PRECISION(LONG_MAX)) + lhs10 >> rhs11; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + if (rhs12 < PRECISION(LONG_MAX)) + lhs10 >> rhs12; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(LONG_MAX)) + lhs10 >> rhs13; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(LONG_MAX)) + lhs10 >> rhs14; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + if (rhs6 < PRECISION(LONG_MAX)) + lhs11 >> rhs6; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + if (rhs7 < PRECISION(LONG_MAX)) + lhs11 >> rhs7; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + if (rhs8 < PRECISION(LONG_MAX)) + lhs11 >> rhs8; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + if (rhs9 < PRECISION(LONG_MAX)) + lhs11 >> rhs9; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + if (rhs10 < PRECISION(LONG_MAX)) + lhs11 >> rhs10; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + if (rhs11 < PRECISION(LONG_MAX)) + lhs11 >> rhs11; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + if (rhs12 < PRECISION(LONG_MAX)) + lhs11 >> rhs12; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(LONG_MAX)) + lhs11 >> rhs13; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(LONG_MAX)) + lhs11 >> rhs14; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + if (rhs12 < PRECISION(ULLONG_MAX)) + lhs12 >> rhs12; // COMPLIANT: lhs12's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs12 < PRECISION(LLONG_MAX)) + lhs13 >> rhs12; // COMPLIANT: lhs13's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(LLONG_MAX)) + lhs13 >> rhs13; // COMPLIANT: lhs13's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(LLONG_MAX)) + lhs13 >> rhs14; // COMPLIANT: lhs13's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + if (rhs12 < PRECISION(LLONG_MAX)) + lhs14 >> rhs12; // COMPLIANT: lhs14's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + if (rhs13 < PRECISION(LLONG_MAX)) + lhs14 >> rhs13; // COMPLIANT: lhs14's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + if (rhs14 < PRECISION(LLONG_MAX)) + lhs14 >> rhs14; // COMPLIANT: lhs14's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard - /* right shift */ + /* ===== Right shift with guards, the shift expression is at `else` branch + * ===== */ - x0 >> x0; // NON_COMPLIANT: x0's precision is not strictly greater than x0's - x0 >> x1; // COMPLIANT: x0's precision is strictly greater than x1's - x0 >> x2; // COMPLIANT: x0's precision is strictly greater than x2's - x0 >> x3; // NON_COMPLIANT: x0's precision is not strictly greater than x3's - x0 >> x4; // NON_COMPLIANT: x0's precision is not strictly greater than x4's - x0 >> x5; // NON_COMPLIANT: x0's precision is not strictly greater than x5's - x0 >> x6; // NON_COMPLIANT: x0's precision is not strictly greater than x6's - x0 >> x7; // NON_COMPLIANT: x0's precision is not strictly greater than x7's - x0 >> x8; // NON_COMPLIANT: x0's precision is not strictly greater than x8's - x0 >> x9; // NON_COMPLIANT: x0's precision is not strictly greater than x9's - x0 >> x10; // NON_COMPLIANT: x0's precision is not strictly greater than x10's - x0 >> x11; // NON_COMPLIANT: x0's precision is not strictly greater than x11's - x0 >> x12; // NON_COMPLIANT: x0's precision is not strictly greater than x12's - x0 >> x13; // NON_COMPLIANT: x0's precision is not strictly greater than x13's - x0 >> x14; // NON_COMPLIANT: x0's precision is not strictly greater than x14's - x1 >> x0; // NON_COMPLIANT: x1's precision is not strictly greater than x0's - x1 >> x1; // NON_COMPLIANT: x1's precision is not strictly greater than x1's - x1 >> x2; // NON_COMPLIANT: x1's precision is not strictly greater than x2's - x1 >> x3; // NON_COMPLIANT: x1's precision is not strictly greater than x3's - x1 >> x4; // NON_COMPLIANT: x1's precision is not strictly greater than x4's - x1 >> x5; // NON_COMPLIANT: x1's precision is not strictly greater than x5's - x1 >> x6; // NON_COMPLIANT: x1's precision is not strictly greater than x6's - x1 >> x7; // NON_COMPLIANT: x1's precision is not strictly greater than x7's - x1 >> x8; // NON_COMPLIANT: x1's precision is not strictly greater than x8's - x1 >> x9; // NON_COMPLIANT: x1's precision is not strictly greater than x9's - x1 >> x10; // NON_COMPLIANT: x1's precision is not strictly greater than x10's - x1 >> x11; // NON_COMPLIANT: x1's precision is not strictly greater than x11's - x1 >> x12; // NON_COMPLIANT: x1's precision is not strictly greater than x12's - x1 >> x13; // NON_COMPLIANT: x1's precision is not strictly greater than x13's - x1 >> x14; // NON_COMPLIANT: x1's precision is not strictly greater than x14's - x2 >> x0; // NON_COMPLIANT: x2's precision is not strictly greater than x0's - x2 >> x1; // NON_COMPLIANT: x2's precision is not strictly greater than x1's - x2 >> x2; // NON_COMPLIANT: x2's precision is not strictly greater than x2's - x2 >> x3; // NON_COMPLIANT: x2's precision is not strictly greater than x3's - x2 >> x4; // NON_COMPLIANT: x2's precision is not strictly greater than x4's - x2 >> x5; // NON_COMPLIANT: x2's precision is not strictly greater than x5's - x2 >> x6; // NON_COMPLIANT: x2's precision is not strictly greater than x6's - x2 >> x7; // NON_COMPLIANT: x2's precision is not strictly greater than x7's - x2 >> x8; // NON_COMPLIANT: x2's precision is not strictly greater than x8's - x2 >> x9; // NON_COMPLIANT: x2's precision is not strictly greater than x9's - x2 >> x10; // NON_COMPLIANT: x2's precision is not strictly greater than x10's - x2 >> x11; // NON_COMPLIANT: x2's precision is not strictly greater than x11's - x2 >> x12; // NON_COMPLIANT: x2's precision is not strictly greater than x12's - x2 >> x13; // NON_COMPLIANT: x2's precision is not strictly greater than x13's - x2 >> x14; // NON_COMPLIANT: x2's precision is not strictly greater than x14's - x3 >> x0; // COMPLIANT: x3's precision is strictly greater than x0's - x3 >> x1; // COMPLIANT: x3's precision is strictly greater than x1's - x3 >> x2; // COMPLIANT: x3's precision is strictly greater than x2's - x3 >> x3; // NON_COMPLIANT: x3's precision is not strictly greater than x3's - x3 >> x4; // COMPLIANT: x3's precision is strictly greater than x4's - x3 >> x5; // COMPLIANT: x3's precision is strictly greater than x5's - x3 >> x6; // NON_COMPLIANT: x3's precision is not strictly greater than x6's - x3 >> x7; // NON_COMPLIANT: x3's precision is not strictly greater than x7's - x3 >> x8; // NON_COMPLIANT: x3's precision is not strictly greater than x8's - x3 >> x9; // NON_COMPLIANT: x3's precision is not strictly greater than x9's - x3 >> x10; // NON_COMPLIANT: x3's precision is not strictly greater than x10's - x3 >> x11; // NON_COMPLIANT: x3's precision is not strictly greater than x11's - x3 >> x12; // NON_COMPLIANT: x3's precision is not strictly greater than x12's - x3 >> x13; // NON_COMPLIANT: x3's precision is not strictly greater than x13's - x3 >> x14; // NON_COMPLIANT: x3's precision is not strictly greater than x14's - x4 >> x0; // COMPLIANT: x4's precision is strictly greater than x0's - x4 >> x1; // COMPLIANT: x4's precision is strictly greater than x1's - x4 >> x2; // COMPLIANT: x4's precision is strictly greater than x2's - x4 >> x3; // NON_COMPLIANT: x4's precision is not strictly greater than x3's - x4 >> x4; // NON_COMPLIANT: x4's precision is not strictly greater than x4's - x4 >> x5; // NON_COMPLIANT: x4's precision is not strictly greater than x5's - x4 >> x6; // NON_COMPLIANT: x4's precision is not strictly greater than x6's - x4 >> x7; // NON_COMPLIANT: x4's precision is not strictly greater than x7's - x4 >> x8; // NON_COMPLIANT: x4's precision is not strictly greater than x8's - x4 >> x9; // NON_COMPLIANT: x4's precision is not strictly greater than x9's - x4 >> x10; // NON_COMPLIANT: x4's precision is not strictly greater than x10's - x4 >> x11; // NON_COMPLIANT: x4's precision is not strictly greater than x11's - x4 >> x12; // NON_COMPLIANT: x4's precision is not strictly greater than x12's - x4 >> x13; // NON_COMPLIANT: x4's precision is not strictly greater than x13's - x4 >> x14; // NON_COMPLIANT: x4's precision is not strictly greater than x14's - x5 >> x0; // COMPLIANT: x5's precision is strictly greater than x0's - x5 >> x1; // COMPLIANT: x5's precision is strictly greater than x1's - x5 >> x2; // COMPLIANT: x5's precision is strictly greater than x2's - x5 >> x3; // NON_COMPLIANT: x5's precision is not strictly greater than x3's - x5 >> x4; // NON_COMPLIANT: x5's precision is not strictly greater than x4's - x5 >> x5; // NON_COMPLIANT: x5's precision is not strictly greater than x5's - x5 >> x6; // NON_COMPLIANT: x5's precision is not strictly greater than x6's - x5 >> x7; // NON_COMPLIANT: x5's precision is not strictly greater than x7's - x5 >> x8; // NON_COMPLIANT: x5's precision is not strictly greater than x8's - x5 >> x9; // NON_COMPLIANT: x5's precision is not strictly greater than x9's - x5 >> x10; // NON_COMPLIANT: x5's precision is not strictly greater than x10's - x5 >> x11; // NON_COMPLIANT: x5's precision is not strictly greater than x11's - x5 >> x12; // NON_COMPLIANT: x5's precision is not strictly greater than x12's - x5 >> x13; // NON_COMPLIANT: x5's precision is not strictly greater than x13's - x5 >> x14; // NON_COMPLIANT: x5's precision is not strictly greater than x14's - x6 >> x0; // COMPLIANT: x6's precision is strictly greater than x0's - x6 >> x1; // COMPLIANT: x6's precision is strictly greater than x1's - x6 >> x2; // COMPLIANT: x6's precision is strictly greater than x2's - x6 >> x3; // COMPLIANT: x6's precision is strictly greater than x3's - x6 >> x4; // COMPLIANT: x6's precision is strictly greater than x4's - x6 >> x5; // COMPLIANT: x6's precision is strictly greater than x5's - x6 >> x6; // NON_COMPLIANT: x6's precision is not strictly greater than x6's - x6 >> x7; // COMPLIANT: x6's precision is strictly greater than x7's - x6 >> x8; // COMPLIANT: x6's precision is strictly greater than x8's - x6 >> x9; // NON_COMPLIANT: x6's precision is not strictly greater than x9's - x6 >> x10; // COMPLIANT: x6's precision is strictly greater than x10's - x6 >> x11; // COMPLIANT: x6's precision is strictly greater than x11's - x6 >> x12; // NON_COMPLIANT: x6's precision is not strictly greater than x12's - x6 >> x13; // NON_COMPLIANT: x6's precision is not strictly greater than x13's - x6 >> x14; // NON_COMPLIANT: x6's precision is not strictly greater than x14's - x7 >> x0; // COMPLIANT: x7's precision is strictly greater than x0's - x7 >> x1; // COMPLIANT: x7's precision is strictly greater than x1's - x7 >> x2; // COMPLIANT: x7's precision is strictly greater than x2's - x7 >> x3; // COMPLIANT: x7's precision is strictly greater than x3's - x7 >> x4; // COMPLIANT: x7's precision is strictly greater than x4's - x7 >> x5; // COMPLIANT: x7's precision is strictly greater than x5's - x7 >> x6; // NON_COMPLIANT: x7's precision is not strictly greater than x6's - x7 >> x7; // NON_COMPLIANT: x7's precision is not strictly greater than x7's - x7 >> x8; // NON_COMPLIANT: x7's precision is not strictly greater than x8's - x7 >> x9; // NON_COMPLIANT: x7's precision is not strictly greater than x9's - x7 >> x10; // NON_COMPLIANT: x7's precision is not strictly greater than x10's - x7 >> x11; // NON_COMPLIANT: x7's precision is not strictly greater than x11's - x7 >> x12; // NON_COMPLIANT: x7's precision is not strictly greater than x12's - x7 >> x13; // NON_COMPLIANT: x7's precision is not strictly greater than x13's - x7 >> x14; // NON_COMPLIANT: x7's precision is not strictly greater than x14's - x8 >> x0; // COMPLIANT: x8's precision is strictly greater than x0's - x8 >> x1; // COMPLIANT: x8's precision is strictly greater than x1's - x8 >> x2; // COMPLIANT: x8's precision is strictly greater than x2's - x8 >> x3; // COMPLIANT: x8's precision is strictly greater than x3's - x8 >> x4; // COMPLIANT: x8's precision is strictly greater than x4's - x8 >> x5; // COMPLIANT: x8's precision is strictly greater than x5's - x8 >> x6; // NON_COMPLIANT: x8's precision is not strictly greater than x6's - x8 >> x7; // NON_COMPLIANT: x8's precision is not strictly greater than x7's - x8 >> x8; // NON_COMPLIANT: x8's precision is not strictly greater than x8's - x8 >> x9; // NON_COMPLIANT: x8's precision is not strictly greater than x9's - x8 >> x10; // NON_COMPLIANT: x8's precision is not strictly greater than x10's - x8 >> x11; // NON_COMPLIANT: x8's precision is not strictly greater than x11's - x8 >> x12; // NON_COMPLIANT: x8's precision is not strictly greater than x12's - x8 >> x13; // NON_COMPLIANT: x8's precision is not strictly greater than x13's - x8 >> x14; // NON_COMPLIANT: x8's precision is not strictly greater than x14's - x9 >> x0; // COMPLIANT: x9's precision is strictly greater than x0's - x9 >> x1; // COMPLIANT: x9's precision is strictly greater than x1's - x9 >> x2; // COMPLIANT: x9's precision is strictly greater than x2's - x9 >> x3; // COMPLIANT: x9's precision is strictly greater than x3's - x9 >> x4; // COMPLIANT: x9's precision is strictly greater than x4's - x9 >> x5; // COMPLIANT: x9's precision is strictly greater than x5's - x9 >> x6; // NON_COMPLIANT: x9's precision is not strictly greater than x6's - x9 >> x7; // COMPLIANT: x9's precision is strictly greater than x7's - x9 >> x8; // COMPLIANT: x9's precision is strictly greater than x8's - x9 >> x9; // NON_COMPLIANT: x9's precision is not strictly greater than x9's - x9 >> x10; // COMPLIANT: x9's precision is strictly greater than x10's - x9 >> x11; // COMPLIANT: x9's precision is strictly greater than x11's - x9 >> x12; // NON_COMPLIANT: x9's precision is not strictly greater than x12's - x9 >> x13; // NON_COMPLIANT: x9's precision is not strictly greater than x13's - x9 >> x14; // NON_COMPLIANT: x9's precision is not strictly greater than x14's - x10 >> x0; // COMPLIANT: x10's precision is strictly greater than x0's - x10 >> x1; // COMPLIANT: x10's precision is strictly greater than x1's - x10 >> x2; // COMPLIANT: x10's precision is strictly greater than x2's - x10 >> x3; // COMPLIANT: x10's precision is strictly greater than x3's - x10 >> x4; // COMPLIANT: x10's precision is strictly greater than x4's - x10 >> x5; // COMPLIANT: x10's precision is strictly greater than x5's - x10 >> x6; // NON_COMPLIANT: x10's precision is not strictly greater than x6's - x10 >> x7; // NON_COMPLIANT: x10's precision is not strictly greater than x7's - x10 >> x8; // NON_COMPLIANT: x10's precision is not strictly greater than x8's - x10 >> x9; // NON_COMPLIANT: x10's precision is not strictly greater than x9's - x10 >> - x10; // NON_COMPLIANT: x10's precision is not strictly greater than x10's - x10 >> - x11; // NON_COMPLIANT: x10's precision is not strictly greater than x11's - x10 >> - x12; // NON_COMPLIANT: x10's precision is not strictly greater than x12's - x10 >> - x13; // NON_COMPLIANT: x10's precision is not strictly greater than x13's - x10 >> - x14; // NON_COMPLIANT: x10's precision is not strictly greater than x14's - x11 >> x0; // COMPLIANT: x11's precision is strictly greater than x0's - x11 >> x1; // COMPLIANT: x11's precision is strictly greater than x1's - x11 >> x2; // COMPLIANT: x11's precision is strictly greater than x2's - x11 >> x3; // COMPLIANT: x11's precision is strictly greater than x3's - x11 >> x4; // COMPLIANT: x11's precision is strictly greater than x4's - x11 >> x5; // COMPLIANT: x11's precision is strictly greater than x5's - x11 >> x6; // NON_COMPLIANT: x11's precision is not strictly greater than x6's - x11 >> x7; // NON_COMPLIANT: x11's precision is not strictly greater than x7's - x11 >> x8; // NON_COMPLIANT: x11's precision is not strictly greater than x8's - x11 >> x9; // NON_COMPLIANT: x11's precision is not strictly greater than x9's - x11 >> - x10; // NON_COMPLIANT: x11's precision is not strictly greater than x10's - x11 >> - x11; // NON_COMPLIANT: x11's precision is not strictly greater than x11's - x11 >> - x12; // NON_COMPLIANT: x11's precision is not strictly greater than x12's - x11 >> - x13; // NON_COMPLIANT: x11's precision is not strictly greater than x13's - x11 >> - x14; // NON_COMPLIANT: x11's precision is not strictly greater than x14's - x12 >> x0; // COMPLIANT: x12's precision is strictly greater than x0's - x12 >> x1; // COMPLIANT: x12's precision is strictly greater than x1's - x12 >> x2; // COMPLIANT: x12's precision is strictly greater than x2's - x12 >> x3; // COMPLIANT: x12's precision is strictly greater than x3's - x12 >> x4; // COMPLIANT: x12's precision is strictly greater than x4's - x12 >> x5; // COMPLIANT: x12's precision is strictly greater than x5's - x12 >> x6; // COMPLIANT: x12's precision is strictly greater than x6's - x12 >> x7; // COMPLIANT: x12's precision is strictly greater than x7's - x12 >> x8; // COMPLIANT: x12's precision is strictly greater than x8's - x12 >> x9; // COMPLIANT: x12's precision is strictly greater than x9's - x12 >> x10; // COMPLIANT: x12's precision is strictly greater than x10's - x12 >> x11; // COMPLIANT: x12's precision is strictly greater than x11's - x12 >> - x12; // NON_COMPLIANT: x12's precision is not strictly greater than x12's - x12 >> x13; // COMPLIANT: x12's precision is strictly greater than x13's - x12 >> x14; // COMPLIANT: x12's precision is strictly greater than x14's - x13 >> x0; // COMPLIANT: x13's precision is strictly greater than x0's - x13 >> x1; // COMPLIANT: x13's precision is strictly greater than x1's - x13 >> x2; // COMPLIANT: x13's precision is strictly greater than x2's - x13 >> x3; // COMPLIANT: x13's precision is strictly greater than x3's - x13 >> x4; // COMPLIANT: x13's precision is strictly greater than x4's - x13 >> x5; // COMPLIANT: x13's precision is strictly greater than x5's - x13 >> x6; // COMPLIANT: x13's precision is strictly greater than x6's - x13 >> x7; // COMPLIANT: x13's precision is strictly greater than x7's - x13 >> x8; // COMPLIANT: x13's precision is strictly greater than x8's - x13 >> x9; // COMPLIANT: x13's precision is strictly greater than x9's - x13 >> x10; // COMPLIANT: x13's precision is strictly greater than x10's - x13 >> x11; // COMPLIANT: x13's precision is strictly greater than x11's - x13 >> - x12; // NON_COMPLIANT: x13's precision is not strictly greater than x12's - x13 >> - x13; // NON_COMPLIANT: x13's precision is not strictly greater than x13's - x13 >> - x14; // NON_COMPLIANT: x13's precision is not strictly greater than x14's - x14 >> x0; // COMPLIANT: x14's precision is strictly greater than x0's - x14 >> x1; // COMPLIANT: x14's precision is strictly greater than x1's - x14 >> x2; // COMPLIANT: x14's precision is strictly greater than x2's - x14 >> x3; // COMPLIANT: x14's precision is strictly greater than x3's - x14 >> x4; // COMPLIANT: x14's precision is strictly greater than x4's - x14 >> x5; // COMPLIANT: x14's precision is strictly greater than x5's - x14 >> x6; // COMPLIANT: x14's precision is strictly greater than x6's - x14 >> x7; // COMPLIANT: x14's precision is strictly greater than x7's - x14 >> x8; // COMPLIANT: x14's precision is strictly greater than x8's - x14 >> x9; // COMPLIANT: x14's precision is strictly greater than x9's - x14 >> x10; // COMPLIANT: x14's precision is strictly greater than x10's - x14 >> x11; // COMPLIANT: x14's precision is strictly greater than x11's - x14 >> - x12; // NON_COMPLIANT: x14's precision is not strictly greater than x12's - x14 >> - x13; // NON_COMPLIANT: x14's precision is not strictly greater than x13's - x14 >> - x14; // NON_COMPLIANT: x14's precision is not strictly greater than x14's + if (rhs0 >= PRECISION(UCHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs0 >> rhs0; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs0, but it's inside a PRECISION guard + } + if (rhs3 >= PRECISION(UCHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs0 >> rhs3; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs3, but it's inside a PRECISION guard + } + if (rhs4 >= PRECISION(UCHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs0 >> rhs4; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs4, but it's inside a PRECISION guard + } + if (rhs5 >= PRECISION(UCHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs0 >> rhs5; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs5, but it's inside a PRECISION guard + } + if (rhs6 >= PRECISION(UCHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs0 >> rhs6; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + } + if (rhs7 >= PRECISION(UCHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs0 >> rhs7; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + } + if (rhs8 >= PRECISION(UCHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs0 >> rhs8; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + } + if (rhs9 >= PRECISION(UCHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs0 >> rhs9; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + } + if (rhs10 >= PRECISION(UCHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs0 >> rhs10; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + } + if (rhs11 >= PRECISION(UCHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs0 >> rhs11; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(UCHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs0 >> rhs12; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(UCHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs0 >> rhs13; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(UCHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs0 >> rhs14; // COMPLIANT: lhs0's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } + if (rhs0 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 >> rhs0; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs0, but it's inside a PRECISION guard + } + if (rhs1 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 >> rhs1; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs1, but it's inside a PRECISION guard + } + if (rhs2 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 >> rhs2; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs2, but it's inside a PRECISION guard + } + if (rhs3 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 >> rhs3; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs3, but it's inside a PRECISION guard + } + if (rhs4 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 >> rhs4; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs4, but it's inside a PRECISION guard + } + if (rhs5 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 >> rhs5; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs5, but it's inside a PRECISION guard + } + if (rhs6 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 >> rhs6; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + } + if (rhs7 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 >> rhs7; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + } + if (rhs8 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 >> rhs8; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + } + if (rhs9 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 >> rhs9; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + } + if (rhs10 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 >> rhs10; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + } + if (rhs11 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 >> rhs11; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 >> rhs12; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 >> rhs13; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs1 >> rhs14; // COMPLIANT: lhs1's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } + if (rhs0 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 >> rhs0; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs0, but it's inside a PRECISION guard + } + if (rhs1 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 >> rhs1; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs1, but it's inside a PRECISION guard + } + if (rhs2 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 >> rhs2; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs2, but it's inside a PRECISION guard + } + if (rhs3 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 >> rhs3; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs3, but it's inside a PRECISION guard + } + if (rhs4 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 >> rhs4; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs4, but it's inside a PRECISION guard + } + if (rhs5 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 >> rhs5; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs5, but it's inside a PRECISION guard + } + if (rhs6 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 >> rhs6; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + } + if (rhs7 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 >> rhs7; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + } + if (rhs8 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 >> rhs8; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + } + if (rhs9 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 >> rhs9; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + } + if (rhs10 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 >> rhs10; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + } + if (rhs11 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 >> rhs11; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 >> rhs12; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 >> rhs13; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(CHAR_MAX)) { + ; /* Handle Error */ + } else { + lhs2 >> rhs14; // COMPLIANT: lhs2's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } + if (rhs3 >= PRECISION(USHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs3 >> rhs3; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs3, but it's inside a PRECISION guard + } + if (rhs6 >= PRECISION(USHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs3 >> rhs6; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + } + if (rhs7 >= PRECISION(USHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs3 >> rhs7; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + } + if (rhs8 >= PRECISION(USHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs3 >> rhs8; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + } + if (rhs9 >= PRECISION(USHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs3 >> rhs9; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + } + if (rhs10 >= PRECISION(USHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs3 >> rhs10; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + } + if (rhs11 >= PRECISION(USHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs3 >> rhs11; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(USHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs3 >> rhs12; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(USHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs3 >> rhs13; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(USHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs3 >> rhs14; // COMPLIANT: lhs3's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } + if (rhs3 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs4 >> rhs3; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs3, but it's inside a PRECISION guard + } + if (rhs4 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs4 >> rhs4; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs4, but it's inside a PRECISION guard + } + if (rhs5 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs4 >> rhs5; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs5, but it's inside a PRECISION guard + } + if (rhs6 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs4 >> rhs6; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + } + if (rhs7 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs4 >> rhs7; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + } + if (rhs8 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs4 >> rhs8; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + } + if (rhs9 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs4 >> rhs9; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + } + if (rhs10 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs4 >> rhs10; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + } + if (rhs11 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs4 >> rhs11; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs4 >> rhs12; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs4 >> rhs13; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs4 >> rhs14; // COMPLIANT: lhs4's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } + if (rhs3 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs5 >> rhs3; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs3, but it's inside a PRECISION guard + } + if (rhs4 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs5 >> rhs4; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs4, but it's inside a PRECISION guard + } + if (rhs5 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs5 >> rhs5; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs5, but it's inside a PRECISION guard + } + if (rhs6 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs5 >> rhs6; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + } + if (rhs7 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs5 >> rhs7; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + } + if (rhs8 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs5 >> rhs8; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + } + if (rhs9 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs5 >> rhs9; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + } + if (rhs10 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs5 >> rhs10; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + } + if (rhs11 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs5 >> rhs11; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs5 >> rhs12; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs5 >> rhs13; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(SHRT_MAX)) { + ; /* Handle Error */ + } else { + lhs5 >> rhs14; // COMPLIANT: lhs5's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } + if (rhs6 >= PRECISION(UINT_MAX)) { + ; /* Handle Error */ + } else { + lhs6 >> rhs6; // COMPLIANT: lhs6's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + } + if (rhs9 >= PRECISION(UINT_MAX)) { + ; /* Handle Error */ + } else { + lhs6 >> rhs9; // COMPLIANT: lhs6's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(UINT_MAX)) { + ; /* Handle Error */ + } else { + lhs6 >> rhs12; // COMPLIANT: lhs6's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(UINT_MAX)) { + ; /* Handle Error */ + } else { + lhs6 >> rhs13; // COMPLIANT: lhs6's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(UINT_MAX)) { + ; /* Handle Error */ + } else { + lhs6 >> rhs14; // COMPLIANT: lhs6's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } + if (rhs6 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs7 >> rhs6; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + } + if (rhs7 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs7 >> rhs7; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + } + if (rhs8 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs7 >> rhs8; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + } + if (rhs9 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs7 >> rhs9; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + } + if (rhs10 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs7 >> rhs10; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + } + if (rhs11 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs7 >> rhs11; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs7 >> rhs12; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs7 >> rhs13; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs7 >> rhs14; // COMPLIANT: lhs7's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } + if (rhs6 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs8 >> rhs6; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + } + if (rhs7 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs8 >> rhs7; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + } + if (rhs8 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs8 >> rhs8; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + } + if (rhs9 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs8 >> rhs9; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + } + if (rhs10 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs8 >> rhs10; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + } + if (rhs11 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs8 >> rhs11; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs8 >> rhs12; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs8 >> rhs13; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(INT_MAX)) { + ; /* Handle Error */ + } else { + lhs8 >> rhs14; // COMPLIANT: lhs8's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } + if (rhs6 >= PRECISION(ULONG_MAX)) { + ; /* Handle Error */ + } else { + lhs9 >> rhs6; // COMPLIANT: lhs9's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + } + if (rhs9 >= PRECISION(ULONG_MAX)) { + ; /* Handle Error */ + } else { + lhs9 >> rhs9; // COMPLIANT: lhs9's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(ULONG_MAX)) { + ; /* Handle Error */ + } else { + lhs9 >> rhs12; // COMPLIANT: lhs9's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(ULONG_MAX)) { + ; /* Handle Error */ + } else { + lhs9 >> rhs13; // COMPLIANT: lhs9's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(ULONG_MAX)) { + ; /* Handle Error */ + } else { + lhs9 >> rhs14; // COMPLIANT: lhs9's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } + if (rhs6 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs10 >> rhs6; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + } + if (rhs7 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs10 >> rhs7; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + } + if (rhs8 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs10 >> rhs8; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + } + if (rhs9 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs10 >> rhs9; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + } + if (rhs10 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs10 >> rhs10; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + } + if (rhs11 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs10 >> rhs11; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs10 >> rhs12; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs10 >> rhs13; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs10 >> rhs14; // COMPLIANT: lhs10's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } + if (rhs6 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs11 >> rhs6; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs6, but it's inside a PRECISION guard + } + if (rhs7 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs11 >> rhs7; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs7, but it's inside a PRECISION guard + } + if (rhs8 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs11 >> rhs8; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs8, but it's inside a PRECISION guard + } + if (rhs9 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs11 >> rhs9; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs9, but it's inside a PRECISION guard + } + if (rhs10 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs11 >> rhs10; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs10, but it's inside a PRECISION guard + } + if (rhs11 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs11 >> rhs11; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs11, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs11 >> rhs12; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs11 >> rhs13; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(LONG_MAX)) { + ; /* Handle Error */ + } else { + lhs11 >> rhs14; // COMPLIANT: lhs11's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(ULLONG_MAX)) { + ; /* Handle Error */ + } else { + lhs12 >> rhs12; // COMPLIANT: lhs12's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(LLONG_MAX)) { + ; /* Handle Error */ + } else { + lhs13 >> rhs12; // COMPLIANT: lhs13's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(LLONG_MAX)) { + ; /* Handle Error */ + } else { + lhs13 >> rhs13; // COMPLIANT: lhs13's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(LLONG_MAX)) { + ; /* Handle Error */ + } else { + lhs13 >> rhs14; // COMPLIANT: lhs13's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } + if (rhs12 >= PRECISION(LLONG_MAX)) { + ; /* Handle Error */ + } else { + lhs14 >> rhs12; // COMPLIANT: lhs14's precision is not strictly greater than + // rhs12, but it's inside a PRECISION guard + } + if (rhs13 >= PRECISION(LLONG_MAX)) { + ; /* Handle Error */ + } else { + lhs14 >> rhs13; // COMPLIANT: lhs14's precision is not strictly greater than + // rhs13, but it's inside a PRECISION guard + } + if (rhs14 >= PRECISION(LLONG_MAX)) { + ; /* Handle Error */ + } else { + lhs14 >> rhs14; // COMPLIANT: lhs14's precision is not strictly greater than + // rhs14, but it's inside a PRECISION guard + } - /* negative shift */ + /* Negative shifts */ - x0 << -1; // NON_COMPLIANT: shifting by a negative operand - x1 << -1; // NON_COMPLIANT: shifting by a negative operand - x2 << -1; // NON_COMPLIANT: shifting by a negative operand - x3 << -1; // NON_COMPLIANT: shifting by a negative operand - x4 << -1; // NON_COMPLIANT: shifting by a negative operand - x5 << -1; // NON_COMPLIANT: shifting by a negative operand - x6 << -1; // NON_COMPLIANT: shifting by a negative operand - x7 << -1; // NON_COMPLIANT: shifting by a negative operand - x8 << -1; // NON_COMPLIANT: shifting by a negative operand - x9 << -1; // NON_COMPLIANT: shifting by a negative operand - x10 << -1; // NON_COMPLIANT: shifting by a negative operand - x11 << -1; // NON_COMPLIANT: shifting by a negative operand - x12 << -1; // NON_COMPLIANT: shifting by a negative operand - x13 << -1; // NON_COMPLIANT: shifting by a negative operand - x14 << -1; // NON_COMPLIANT: shifting by a negative operand + lhs0 << -1; // NON_COMPLIANT: shifting by a negative operand + lhs1 << -1; // NON_COMPLIANT: shifting by a negative operand + lhs2 << -1; // NON_COMPLIANT: shifting by a negative operand + lhs3 << -1; // NON_COMPLIANT: shifting by a negative operand + lhs4 << -1; // NON_COMPLIANT: shifting by a negative operand + lhs5 << -1; // NON_COMPLIANT: shifting by a negative operand + lhs6 << -1; // NON_COMPLIANT: shifting by a negative operand + lhs7 << -1; // NON_COMPLIANT: shifting by a negative operand + lhs8 << -1; // NON_COMPLIANT: shifting by a negative operand + lhs9 << -1; // NON_COMPLIANT: shifting by a negative operand + lhs10 << -1; // NON_COMPLIANT: shifting by a negative operand + lhs11 << -1; // NON_COMPLIANT: shifting by a negative operand + lhs12 << -1; // NON_COMPLIANT: shifting by a negative operand + lhs13 << -1; // NON_COMPLIANT: shifting by a negative operand + lhs14 << -1; // NON_COMPLIANT: shifting by a negative operand return 0; -} \ No newline at end of file +} From fb1fd83e393c6f58d107212ddb12558c02dadbbe Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Wed, 22 Mar 2023 16:20:16 -0700 Subject: [PATCH 37/53] Fix error in test of INT36-C --- c/cert/test/rules/INT36-C/test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/cert/test/rules/INT36-C/test.c b/c/cert/test/rules/INT36-C/test.c index c4c7487502..e289f34fd4 100644 --- a/c/cert/test/rules/INT36-C/test.c +++ b/c/cert/test/rules/INT36-C/test.c @@ -20,7 +20,7 @@ int main() { 0x01abcdef; // NON_COMPLIANT: assigning raw hex to pointer variable int *int_pointer4 = integer1; // NON_COMPLIANT: declaring pointer variable with integer value - *int_pointer4 = + int_pointer4 = integer1 + 1; // NON_COMPLIANT: assigning integer rvalue to pointer variable int *integer_address5 = From 37787242c3ce3c3022c4cb03ab95824019962c25 Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Wed, 22 Mar 2023 20:13:00 -0700 Subject: [PATCH 38/53] Incorporate changes for INT36-C --- ...tingAPointerToIntegerOrIntegerToPointer.ql | 106 +++++++----------- 1 file changed, 40 insertions(+), 66 deletions(-) diff --git a/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql b/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql index 2971c07770..f85f838c9e 100644 --- a/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql +++ b/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql @@ -17,85 +17,59 @@ class LiteralZero extends Literal { LiteralZero() { this.getValue() = "0" } } -class StdIntIntPtrType extends IntPointerType { +class StdIntIntPtrType extends Type { StdIntIntPtrType() { - this.getFile().(HeaderFile).getBaseName() = "stdint.h" and - this.getName().regexpMatch("u?intptr_t") - } -} + exists(TypeDeclarationEntry entry | + /* + * Just check if there is a header file, + * because we don't know what header file the declaration might live in + */ -/* 1. Declaring an integer variable to hold a pointer value or the opposite, excluding compliant exceptions */ -predicate integerVariableWithPointerValue(Variable var, string message) { - ( - // Declaring an integer variable to hold a pointer value - var.getUnderlyingType() instanceof IntType and - var.getAnAssignedValue().getUnderlyingType() instanceof PointerType and - message = - "Integer variable " + var + " is declared as an expression " + var.getAnAssignedValue() + - ", which is of a pointer type." - or - // Declaring an pointer variable to hold a integer value - var.getUnderlyingType() instanceof PointerType and - var.getAnAssignedValue().getUnderlyingType() instanceof IntType and - message = - "Pointer variable " + var + " is declared as an expression " + var.getAnAssignedValue() + - ", which is of integer type." - ) and - /* Compliant exception 1: literal 0 */ - not var.getAnAssignedValue() instanceof LiteralZero and - /* Compliant exception 2: variable's declared type is (u)intptr_t */ - not var.getUnderlyingType() instanceof StdIntIntPtrType -} + exists(entry.getFile().(HeaderFile)) and + entry.getType() = this and + this.getName().regexpMatch("u?intptr_t") + ) + } -/* 2. Assigning an integer variable a pointer a pointer value, excluding literal 0 */ -predicate assigningPointerValueToInteger(Assignment assign, string message) { - ( - assign.getLValue().getUnderlyingType() instanceof IntType and - assign.getRValue().getUnderlyingType() instanceof PointerType and - message = - "Integer variable " + assign.getLValue() + " is assigned an expression " + assign.getRValue() + - ", which is of a pointer type." - or - assign.getLValue().getUnderlyingType() instanceof PointerType and - assign.getRValue().getUnderlyingType() instanceof IntType and - message = - "Pointer variable " + assign.getLValue() + " is assigned an expression " + assign.getRValue() + - ", which is of integer type." - ) and - /* Compliant exception 1: literal 0 */ - not assign.getRValue() instanceof LiteralZero and - /* Compliant exception 2: variable's declared type is (u)intptr_t */ - not assign.getLValue().getUnderlyingType() instanceof StdIntIntPtrType + override string toString() { + if this.getName() = "uintptr_t" then result = "uintptr_t" else result = "intptr_t" + } } -/* 3. Casting a pointer value to integer, excluding literal 0 */ -predicate castingPointerToInteger(Cast cast, string message) { - not cast.isCompilerGenerated() and - ( - cast.getExpr().getUnderlyingType() instanceof IntType and - cast.getUnderlyingType() instanceof PointerType and - message = "Integer expression " + cast.getExpr() + " is cast to a pointer type." +/** + * Casting a pointer value to integer, excluding literal 0. + * Includes implicit conversions made during declarations or assignments. + */ +predicate conversionBetweenPointerAndInteger(Cast cast, string message) { + /* Ensure that `int` has different size than that of pointers */ + exists(IntType intType, PointerType ptrType | intType.getSize() < ptrType.getSize() | + cast.getExpr().getUnderlyingType() = intType and + cast.getUnderlyingType() = ptrType and + if cast.isCompilerGenerated() + then message = "Integer expression " + cast.getExpr() + " is implicitly cast to a pointer type." + else message = "Integer expression " + cast.getExpr() + " is cast to a pointer type." or - cast.getExpr().getUnderlyingType() instanceof PointerType and - cast.getUnderlyingType() instanceof IntType and - message = "Pointer expression " + cast.getExpr() + " is cast to integer type." + cast.getExpr().getUnderlyingType() = ptrType and + cast.getUnderlyingType() = intType and + if cast.isCompilerGenerated() + then + message = "Pointer expression " + cast.getExpr() + " is implicitly cast to an integer type." + else message = "Pointer expression " + cast.getExpr() + " is cast to an integer type." ) and /* Compliant exception 1: literal 0 */ not cast.getExpr() instanceof LiteralZero and /* Compliant exception 2: variable's declared type is (u)intptr_t */ - not cast.getUnderlyingType() instanceof StdIntIntPtrType + not ( + cast.getType() instanceof StdIntIntPtrType and + cast.getExpr().getType() instanceof VoidPointerType + or + cast.getType() instanceof VoidPointerType and + cast.getExpr().getType() instanceof StdIntIntPtrType + ) } from Element elem, string message where not isExcluded(elem, TypesPackage::convertingAPointerToIntegerOrIntegerToPointerQuery()) and - ( - integerVariableWithPointerValue(elem, message) - or - assigningPointerValueToInteger(elem, message) - or - castingPointerToInteger(elem, message) - ) and - /* Ensure that `int` has different size than that of pointers */ - forall(IntType intType, PointerType ptrType | intType.getSize() != ptrType.getSize()) + conversionBetweenPointerAndInteger(elem, message) select elem, message From 907e1588b0603c5048e40ef5e8c1783b1feb6bfc Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Thu, 23 Mar 2023 17:41:59 -0700 Subject: [PATCH 39/53] Finalize INT34-C --- ...ftedbyNegativeOrGreaterPrecisionOperand.ql | 101 ++++++++---------- 1 file changed, 45 insertions(+), 56 deletions(-) diff --git a/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql b/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql index 354e651c2a..978dc8ccb2 100644 --- a/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql +++ b/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql @@ -13,6 +13,7 @@ import cpp import codingstandards.c.cert import semmle.code.cpp.rangeanalysis.SimpleRangeAnalysis +import semmle.code.cpp.ir.internal.ASTValueNumbering import semmle.code.cpp.controlflow.Guards /* @@ -34,6 +35,21 @@ class PrecisionMacro extends Macro { PrecisionMacro() { this.getName().toLowerCase().matches("precision") } } +class LiteralZero extends Literal { + LiteralZero() { this.getValue() = "0" } +} + +class BitShiftExpr extends BinaryBitwiseOperation { + BitShiftExpr() { + this instanceof LShiftExpr or + this instanceof RShiftExpr + } + + override string toString() { + if this instanceof LShiftExpr then result = "left-shift" else result = "right-shift" + } +} + int getPrecision(BuiltInType type) { type.(CharType).isExplicitlyUnsigned() and result = type.(CharType).getSize() * 8 or @@ -66,80 +82,53 @@ int getPrecision(BuiltInType type) { result = type.(LongLongType).getSize() * 8 - 1 } -predicate isForbiddenLShiftExpr(LShiftExpr binbitop, string message) { +predicate isForbiddenShiftExpr(BitShiftExpr shift, string message) { ( ( - getPrecision(binbitop.getLeftOperand().getUnderlyingType()) <= - upperBound(binbitop.getRightOperand()) and + getPrecision(shift.getLeftOperand().getUnderlyingType()) <= + upperBound(shift.getRightOperand()) and message = - "The operand " + binbitop.getLeftOperand() + " is left-shifted by an expression " + - binbitop.getRightOperand() + " which is greater than or equal to in precision." + "The operand " + shift.getLeftOperand() + " is " + shift + "ed by an expression " + + shift.getRightOperand() + " which is greater than or equal to in precision." or - lowerBound(binbitop.getRightOperand()) < 0 and + lowerBound(shift.getRightOperand()) < 0 and message = - "The operand " + binbitop.getLeftOperand() + " is left-shifted by a negative expression " + - binbitop.getRightOperand() + "." - ) - or - /* Check a guard condition protecting the shift statement: heuristic (not an iff query) */ - exists(GuardCondition gc, BasicBlock block, Expr precisionCall | - block = binbitop.getBasicBlock() and - ( - precisionCall.(FunctionCall).getTarget() instanceof PopCount - or - precisionCall = any(PrecisionMacro pm).getAnInvocation().getExpr() - ) - | - /* - * Shift statement is at a basic block where - * `shift_rhs < PRECISION(...)` is ensured - */ - - not gc.ensuresLt(binbitop.getRightOperand(), precisionCall, 0, block, true) + "The operand " + shift.getLeftOperand() + " is " + shift + "ed by a negative expression " + + shift.getRightOperand() + "." ) and - message = "TODO" - ) -} + /* + * Shift statement is not at a basic block where + * `shift_rhs < PRECISION(...)` is ensured + */ -predicate isForbiddenRShiftExpr(RShiftExpr binbitop, string message) { - ( - ( - getPrecision(binbitop.getLeftOperand().getUnderlyingType()) <= - upperBound(binbitop.getRightOperand()) and - message = - "The operand " + binbitop.getLeftOperand() + " is right-shifted by an expression " + - binbitop.getRightOperand() + " which is greater than or equal to in precision." - or - lowerBound(binbitop.getRightOperand()) < 0 and - message = - "The operand " + binbitop.getLeftOperand() + " is right-shifted by a negative expression " + - binbitop.getRightOperand() + "." - ) - or - /* Check a guard condition protecting the shift statement: heuristic (not an iff query) */ - exists(GuardCondition gc, BasicBlock block, Expr precisionCall | - block = binbitop.getBasicBlock() and + not exists(GuardCondition gc, BasicBlock block, Expr precisionCall, Expr lTLhs | + block = shift.getBasicBlock() and ( precisionCall.(FunctionCall).getTarget() instanceof PopCount or precisionCall = any(PrecisionMacro pm).getAnInvocation().getExpr() ) | - /* - * Shift statement is at a basic block where - * `shift_rhs < PRECISION(...)` is ensured - */ - - not gc.ensuresLt(binbitop.getRightOperand(), precisionCall, 0, block, true) + globalValueNumber(lTLhs) = globalValueNumber(shift.getRightOperand()) and + gc.ensuresLt(lTLhs, precisionCall, 0, block, true) ) and - message = "TODO" + /* + * Shift statement is not at a basic block where + * `shift_rhs < 0` is ensured + */ + + not exists(GuardCondition gc, BasicBlock block, Expr literalZero, Expr lTLhs | + block = shift.getBasicBlock() and + literalZero instanceof LiteralZero + | + globalValueNumber(lTLhs) = globalValueNumber(shift.getRightOperand()) and + gc.ensuresLt(lTLhs, literalZero, 0, block, true) + ) ) } from BinaryBitwiseOperation badShift, string message where not isExcluded(badShift, TypesPackage::exprShiftedbyNegativeOrGreaterPrecisionOperandQuery()) and - isForbiddenLShiftExpr(badShift, message) - or - isForbiddenRShiftExpr(badShift, message) + isForbiddenShiftExpr(badShift, message) select badShift, message From ec36bebe088799f04bff448e0b08d43487eaa5d9 Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Thu, 23 Mar 2023 17:51:53 -0700 Subject: [PATCH 40/53] Update .expected for INT36-C --- ...gAPointerToIntegerOrIntegerToPointer.expected | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/c/cert/test/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.expected b/c/cert/test/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.expected index fc119af0b2..67a3935c0f 100644 --- a/c/cert/test/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.expected +++ b/c/cert/test/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.expected @@ -1,11 +1,9 @@ -| test.c:17:8:17:19 | int_pointer3 | Pointer variable int_pointer3 is declared as an expression 28036591, which is of integer type. | -| test.c:19:3:20:16 | ... = ... | Pointer variable int_pointer3 is assigned an expression 28036591, which is of integer type. | -| test.c:21:8:21:19 | int_pointer4 | Pointer variable int_pointer4 is declared as an expression integer1, which is of integer type. | -| test.c:26:8:26:23 | integer_address5 | Pointer variable integer_address5 is declared as an expression 28036591, which is of integer type. | +| test.c:17:23:17:32 | (int *)... | Integer expression 28036591 is implicitly cast to a pointer type. | +| test.c:20:7:20:16 | (int *)... | Integer expression 28036591 is implicitly cast to a pointer type. | +| test.c:22:7:22:14 | (int *)... | Integer expression integer1 is implicitly cast to a pointer type. | +| test.c:24:7:25:7 | (int *)... | Integer expression ... + ... is implicitly cast to a pointer type. | | test.c:27:7:27:23 | (int *)... | Integer expression 28036591 is cast to a pointer type. | -| test.c:28:8:28:23 | integer_address6 | Pointer variable integer_address6 is declared as an expression integer1, which is of integer type. | | test.c:29:7:29:21 | (int *)... | Integer expression integer1 is cast to a pointer type. | -| test.c:34:7:34:22 | integer_address8 | Integer variable integer_address8 is declared as an expression & ..., which is of a pointer type. | -| test.c:36:3:36:30 | ... = ... | Integer variable integer_address8 is assigned an expression & ..., which is of a pointer type. | -| test.c:38:7:38:21 | integer_address | Integer variable integer_address is declared as an expression & ..., which is of a pointer type. | -| test.c:39:7:39:20 | (int)... | Pointer expression & ... is cast to integer type. | +| test.c:34:26:34:34 | (int)... | Pointer expression & ... is implicitly cast to an integer type. | +| test.c:36:22:36:30 | (int)... | Pointer expression & ... is implicitly cast to an integer type. | +| test.c:39:7:39:20 | (int)... | Pointer expression & ... is cast to an integer type. | From 7de306dd1854b0fbd453d028e1c3611cbf9344fd Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Thu, 23 Mar 2023 18:04:30 -0700 Subject: [PATCH 41/53] Format test suites --- c/cert/test/rules/INT34-C/test.c | 2 +- c/misra/test/rules/RULE-7-4/test.c | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/c/cert/test/rules/INT34-C/test.c b/c/cert/test/rules/INT34-C/test.c index e72c2b44d2..44f2b28e70 100644 --- a/c/cert/test/rules/INT34-C/test.c +++ b/c/cert/test/rules/INT34-C/test.c @@ -2,7 +2,7 @@ #include #include -extern size_t popcount(uintmax_t) {}; +extern size_t popcount(uintmax_t){}; #define PRECISION(x) popcount(x) int main() { diff --git a/c/misra/test/rules/RULE-7-4/test.c b/c/misra/test/rules/RULE-7-4/test.c index 5aed71ffe7..c178915200 100644 --- a/c/misra/test/rules/RULE-7-4/test.c +++ b/c/misra/test/rules/RULE-7-4/test.c @@ -1,5 +1,5 @@ -#include #include +#include void sample1() { /* Test for plain char type */ @@ -16,15 +16,15 @@ void sample1() { /* Test for wide char type */ const wchar_t *ws1 = L"wide string1"; // COMPLIANT: string literal assigned to - // a const char* variable + // a const char* variable const register volatile wchar_t *ws2 = L"wide string2"; // COMPLIANT: string literal assigned to a const char* - // variable, don't care about the qualifiers - wchar_t *ws3 = L"wide string3"; // NON_COMPLIANT: char* variable declared to hold - // a string literal - ws3 = L"wide string4"; // NON_COMPLIANT: char* variable assigned a string - // literal (not likely to be seen in production, since - // there is strcpy) + // variable, don't care about the qualifiers + wchar_t *ws3 = L"wide string3"; // NON_COMPLIANT: char* variable declared to + // hold a string literal + ws3 = L"wide string4"; // NON_COMPLIANT: char* variable assigned a string + // literal (not likely to be seen in production, since + // there is strcpy) } /* Testing returning a plain string literal */ @@ -39,8 +39,8 @@ const char *sample2(int x) { /* Testing returning a wide string literal */ const wchar_t *w_sample2(int x) { if (x == 1) - return L"string5"; // COMPLIANT: can return a string literal with return type - // being const char* being const char* + return L"string5"; // COMPLIANT: can return a string literal with return + // type being const char* being const char* else return NULL; } @@ -56,7 +56,7 @@ char *sample3(int x) { wchar_t *w_sample3(int x) { if (x == 1) return L"string6"; // NON_COMPLIANT: can return a string literal with return - // type being char* + // type being char* else return NULL; } From fbdbff1bf350a6f2f44b51ff1e7540ecbfb50401 Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Thu, 23 Mar 2023 19:06:51 -0700 Subject: [PATCH 42/53] Rename rule package to Types1 --- ...ftedbyNegativeOrGreaterPrecisionOperand.ql | 2 +- ...tingAPointerToIntegerOrIntegerToPointer.ql | 2 +- ...ainNumericalTypeUsedOverExplicitTypedef.ql | 2 +- .../SizeofOperatorUsedOnArrayTypeParam.ql | 2 +- .../StringLiteralAssignedToNonConstChar.ql | 2 +- .../cpp/exclusions/c/RuleMetadata.qll | 6 +- .../cpp/exclusions/c/Types.qll | 95 ---- rule_packages/c/Types.json | 482 ------------------ rules.csv | 10 +- 9 files changed, 13 insertions(+), 590 deletions(-) delete mode 100644 cpp/common/src/codingstandards/cpp/exclusions/c/Types.qll delete mode 100644 rule_packages/c/Types.json diff --git a/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql b/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql index 978dc8ccb2..1f73583cfb 100644 --- a/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql +++ b/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql @@ -129,6 +129,6 @@ predicate isForbiddenShiftExpr(BitShiftExpr shift, string message) { from BinaryBitwiseOperation badShift, string message where - not isExcluded(badShift, TypesPackage::exprShiftedbyNegativeOrGreaterPrecisionOperandQuery()) and + not isExcluded(badShift, Types1Package::exprShiftedbyNegativeOrGreaterPrecisionOperandQuery()) and isForbiddenShiftExpr(badShift, message) select badShift, message diff --git a/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql b/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql index f85f838c9e..5d8d13b0ed 100644 --- a/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql +++ b/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql @@ -70,6 +70,6 @@ predicate conversionBetweenPointerAndInteger(Cast cast, string message) { from Element elem, string message where - not isExcluded(elem, TypesPackage::convertingAPointerToIntegerOrIntegerToPointerQuery()) and + not isExcluded(elem, Types1Package::convertingAPointerToIntegerOrIntegerToPointerQuery()) and conversionBetweenPointerAndInteger(elem, message) select elem, message diff --git a/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql b/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql index 29dd1c16d4..16d8af6595 100644 --- a/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql +++ b/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql @@ -45,7 +45,7 @@ predicate forbiddenTypedef(TypedefType typedef, string message) { from Element elem, string message where - not isExcluded(elem, TypesPackage::plainNumericalTypeUsedOverExplicitTypedefQuery()) and + not isExcluded(elem, Types1Package::plainNumericalTypeUsedOverExplicitTypedefQuery()) and ( forbiddenBuiltinNumericUsedInDecl(elem, message) or forbiddenTypedef(elem, message) diff --git a/c/misra/src/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.ql b/c/misra/src/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.ql index 2215c819fd..3eed267198 100644 --- a/c/misra/src/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.ql +++ b/c/misra/src/rules/RULE-12-5/SizeofOperatorUsedOnArrayTypeParam.ql @@ -15,7 +15,7 @@ import codingstandards.c.misra from SizeofExprOperator sizeof where - not isExcluded(sizeof, TypesPackage::sizeofOperatorUsedOnArrayTypeParamQuery()) and + not isExcluded(sizeof, Types1Package::sizeofOperatorUsedOnArrayTypeParamQuery()) and exists(Parameter param | sizeof.getExprOperand().(VariableAccess).getTarget() = param and param.getType() instanceof ArrayType diff --git a/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql b/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql index 311177e4b7..a295c91f7b 100644 --- a/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql +++ b/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql @@ -93,7 +93,7 @@ predicate returningNonConstCharVar(ReturnStmt return, string message) { from Element elem, string message where - not isExcluded(elem, TypesPackage::stringLiteralAssignedToNonConstCharQuery()) and + not isExcluded(elem, Types1Package::stringLiteralAssignedToNonConstCharQuery()) and ( declaringNonConstCharVar(elem, message) or diff --git a/cpp/common/src/codingstandards/cpp/exclusions/c/RuleMetadata.qll b/cpp/common/src/codingstandards/cpp/exclusions/c/RuleMetadata.qll index a3a2ef1758..6d56ad3073 100644 --- a/cpp/common/src/codingstandards/cpp/exclusions/c/RuleMetadata.qll +++ b/cpp/common/src/codingstandards/cpp/exclusions/c/RuleMetadata.qll @@ -52,7 +52,7 @@ import Strings1 import Strings2 import Strings3 import Syntax -import Types +import Types1 /** The TQuery type representing this language * */ newtype TCQuery = @@ -106,7 +106,7 @@ newtype TCQuery = TStrings2PackageQuery(Strings2Query q) or TStrings3PackageQuery(Strings3Query q) or TSyntaxPackageQuery(SyntaxQuery q) or - TTypesPackageQuery(TypesQuery q) + TTypes1PackageQuery(Types1Query q) /** The metadata predicate * */ predicate isQueryMetadata(Query query, string queryId, string ruleId, string category) { @@ -160,5 +160,5 @@ predicate isQueryMetadata(Query query, string queryId, string ruleId, string cat isStrings2QueryMetadata(query, queryId, ruleId, category) or isStrings3QueryMetadata(query, queryId, ruleId, category) or isSyntaxQueryMetadata(query, queryId, ruleId, category) or - isTypesQueryMetadata(query, queryId, ruleId, category) + isTypes1QueryMetadata(query, queryId, ruleId, category) } diff --git a/cpp/common/src/codingstandards/cpp/exclusions/c/Types.qll b/cpp/common/src/codingstandards/cpp/exclusions/c/Types.qll deleted file mode 100644 index 970e07f6c9..0000000000 --- a/cpp/common/src/codingstandards/cpp/exclusions/c/Types.qll +++ /dev/null @@ -1,95 +0,0 @@ -//** THIS FILE IS AUTOGENERATED, DO NOT MODIFY DIRECTLY. **/ -import cpp -import RuleMetadata -import codingstandards.cpp.exclusions.RuleMetadata - -newtype TypesQuery = - TExprShiftedbyNegativeOrGreaterPrecisionOperandQuery() or - TConvertingAPointerToIntegerOrIntegerToPointerQuery() or - TPlainNumericalTypeUsedOverExplicitTypedefQuery() or - TSizeofOperatorUsedOnArrayTypeParamQuery() or - TStringLiteralAssignedToNonConstCharQuery() - -predicate isTypesQueryMetadata(Query query, string queryId, string ruleId, string category) { - query = - // `Query` instance for the `exprShiftedbyNegativeOrGreaterPrecisionOperand` query - TypesPackage::exprShiftedbyNegativeOrGreaterPrecisionOperandQuery() and - queryId = - // `@id` for the `exprShiftedbyNegativeOrGreaterPrecisionOperand` query - "c/cert/expr-shiftedby-negative-or-greater-precision-operand" and - ruleId = "INT34-C" and - category = "rule" - or - query = - // `Query` instance for the `convertingAPointerToIntegerOrIntegerToPointer` query - TypesPackage::convertingAPointerToIntegerOrIntegerToPointerQuery() and - queryId = - // `@id` for the `convertingAPointerToIntegerOrIntegerToPointer` query - "c/cert/converting-a-pointer-to-integer-or-integer-to-pointer" and - ruleId = "INT36-C" and - category = "rule" - or - query = - // `Query` instance for the `plainNumericalTypeUsedOverExplicitTypedef` query - TypesPackage::plainNumericalTypeUsedOverExplicitTypedefQuery() and - queryId = - // `@id` for the `plainNumericalTypeUsedOverExplicitTypedef` query - "c/misra/plain-numerical-type-used-over-explicit-typedef" and - ruleId = "DIR-4-6" and - category = "advisory" - or - query = - // `Query` instance for the `sizeofOperatorUsedOnArrayTypeParam` query - TypesPackage::sizeofOperatorUsedOnArrayTypeParamQuery() and - queryId = - // `@id` for the `sizeofOperatorUsedOnArrayTypeParam` query - "c/misra/sizeof-operator-used-on-array-type-param" and - ruleId = "RULE-12-5" and - category = "mandatory" - or - query = - // `Query` instance for the `stringLiteralAssignedToNonConstChar` query - TypesPackage::stringLiteralAssignedToNonConstCharQuery() and - queryId = - // `@id` for the `stringLiteralAssignedToNonConstChar` query - "c/misra/string-literal-assigned-to-non-const-char" and - ruleId = "RULE-7-4" and - category = "required" -} - -module TypesPackage { - Query exprShiftedbyNegativeOrGreaterPrecisionOperandQuery() { - //autogenerate `Query` type - result = - // `Query` type for `exprShiftedbyNegativeOrGreaterPrecisionOperand` query - TQueryC(TTypesPackageQuery(TExprShiftedbyNegativeOrGreaterPrecisionOperandQuery())) - } - - Query convertingAPointerToIntegerOrIntegerToPointerQuery() { - //autogenerate `Query` type - result = - // `Query` type for `convertingAPointerToIntegerOrIntegerToPointer` query - TQueryC(TTypesPackageQuery(TConvertingAPointerToIntegerOrIntegerToPointerQuery())) - } - - Query plainNumericalTypeUsedOverExplicitTypedefQuery() { - //autogenerate `Query` type - result = - // `Query` type for `plainNumericalTypeUsedOverExplicitTypedef` query - TQueryC(TTypesPackageQuery(TPlainNumericalTypeUsedOverExplicitTypedefQuery())) - } - - Query sizeofOperatorUsedOnArrayTypeParamQuery() { - //autogenerate `Query` type - result = - // `Query` type for `sizeofOperatorUsedOnArrayTypeParam` query - TQueryC(TTypesPackageQuery(TSizeofOperatorUsedOnArrayTypeParamQuery())) - } - - Query stringLiteralAssignedToNonConstCharQuery() { - //autogenerate `Query` type - result = - // `Query` type for `stringLiteralAssignedToNonConstChar` query - TQueryC(TTypesPackageQuery(TStringLiteralAssignedToNonConstCharQuery())) - } -} diff --git a/rule_packages/c/Types.json b/rule_packages/c/Types.json deleted file mode 100644 index aa9e8d3fef..0000000000 --- a/rule_packages/c/Types.json +++ /dev/null @@ -1,482 +0,0 @@ -{ - "CERT-C": { - "FLP32-C": { - "properties": { - "obligation": "rule" - }, - "queries": [ - { - "description": "TODO.", - "kind": "problem", - "name": "Prevent or detect domain and range errors in math functions", - "precision": "very-high", - "severity": "error", - "short_name": "PreventOrDetectDomainAndRangeErrorsInMathFunctions", - "tags": [] - } - ], - "title": "Prevent or detect domain and range errors in math functions" - }, - "FLP34-C": { - "properties": { - "obligation": "rule" - }, - "queries": [ - { - "description": "TODO.", - "kind": "problem", - "name": "Ensure that floating-point conversions are within range of the new type", - "precision": "very-high", - "severity": "error", - "short_name": "EnsureThatFloatingPointConversionsAreWithinRangeOf", - "tags": [] - } - ], - "title": "Ensure that floating-point conversions are within range of the new type" - }, - "FLP36-C": { - "properties": { - "obligation": "rule" - }, - "queries": [ - { - "description": "TODO.", - "kind": "problem", - "name": "Preserve precision when converting integral values to floating-point type", - "precision": "very-high", - "severity": "error", - "short_name": "PreservePrecisionWhenConverting", - "tags": [] - } - ], - "title": "Preserve precision when converting integral values to floating-point type" - }, - "FLP37-C": { - "properties": { - "obligation": "rule" - }, - "queries": [ - { - "description": "TODO.", - "kind": "problem", - "name": "Do not use object representations to compare floating-point values", - "precision": "very-high", - "severity": "error", - "short_name": "DoNotUseObjectRepresentations", - "tags": [] - } - ], - "title": "Do not use object representations to compare floating-point values" - }, - "INT30-C": { - "properties": { - "obligation": "rule" - }, - "queries": [ - { - "description": "TODO.", - "kind": "problem", - "name": "Ensure that unsigned integer operations do not wrap", - "precision": "high", - "severity": "error", - "short_name": "EnsureThatUnsigne", - "tags": [] - } - ], - "title": "Ensure that unsigned integer operations do not wrap" - }, - "INT31-C": { - "properties": { - "obligation": "rule" - }, - "queries": [ - { - "description": "TODO.", - "kind": "problem", - "name": "Ensure that integer conversions do not result in lost or misinterpreted data", - "precision": "high", - "severity": "error", - "short_name": "EnsureThatIntegerConversionsD", - "tags": [] - } - ], - "title": "Ensure that integer conversions do not result in lost or misinterpreted data" - }, - "INT32-C": { - "properties": { - "obligation": "rule" - }, - "queries": [ - { - "description": "TODO.", - "kind": "problem", - "name": "Ensure that operations on signed integers do not result in overflow", - "precision": "high", - "severity": "error", - "short_name": "EnsureThatOperationsOnSignedInt", - "tags": [] - } - ], - "title": "Ensure that operations on signed integers do not result in overflow" - }, - "INT33-C": { - "properties": { - "obligation": "rule" - }, - "queries": [ - { - "description": "TODO.", - "kind": "problem", - "name": "Ensure that division and remainder operations do not result in divide-by-zero errors", - "precision": "high", - "severity": "error", - "short_name": "EnsureThatDivisionAndRemainderO", - "tags": [] - } - ], - "title": "Ensure that division and remainder operations do not result in divide-by-zero errors" - }, - "INT34-C": { - "properties": { - "obligation": "rule" - }, - "queries": [ - { - "description": "Shifting an expression by an operand that is negative or of precision greater or equal to that or the another causes representational error.", - "kind": "problem", - "name": "Bit shift should not be done by a negative operand or an operand of greater-or-equal precision than that of another", - "precision": "very-high", - "severity": "error", - "short_name": "ExprShiftedbyNegativeOrGreaterPrecisionOperand", - "tags": [] - } - ], - "title": "Do not shift an expression by a negative number of bits or by greater than or equal to the number of bits that exist in the operand" - }, - "INT35-C": { - "properties": { - "obligation": "rule" - }, - "queries": [ - { - "description": "TODO.", - "kind": "problem", - "name": "Use correct integer precisions", - "precision": "high", - "severity": "error", - "short_name": "UseCorrectIntegerPrecisions", - "tags": [] - } - ], - "title": "Use correct integer precisions" - }, - "INT36-C": { - "properties": { - "obligation": "rule" - }, - "queries": [ - { - "description": "Converting between pointers and integers is not portable and might cause invalid memory access.", - "kind": "problem", - "name": "Do not convert pointers to integers and back", - "precision": "very-high", - "severity": "error", - "short_name": "ConvertingAPointerToIntegerOrIntegerToPointer", - "tags": [] - } - ], - "title": "Converting a pointer to integer or integer to pointer" - } - }, - "MISRA-C-2012": { - "DIR-4-6": { - "properties": { - "obligation": "advisory" - }, - "queries": [ - { - "description": "Using plain numerical types over typedefs with explicit sign and bit counts may lead to confusion on how much bits are allocated for a value.", - "kind": "problem", - "name": "Do not use plain numerical types over typedefs named after their explicit bit layout", - "precision": "high", - "severity": "error", - "short_name": "PlainNumericalTypeUsedOverExplicitTypedef", - "tags": [] - } - ], - "title": "typedefs that indicate size and signedness should be used in place of the basic numerical types" - }, - "RULE-10-1": { - "properties": { - "obligation": "required" - }, - "queries": [ - { - "description": "TODO.", - "kind": "problem", - "name": "Operands shall not be of an inappropriate essential type", - "precision": "high", - "severity": "error", - "short_name": "OperandsOfAnInappropriateEssentialType", - "tags": [] - } - ], - "title": "Operands shall not be of an inappropriate essential type" - }, - "RULE-10-2": { - "properties": { - "obligation": "required" - }, - "queries": [ - { - "description": "Expressions of essentially character type shall not be used inappropriately in addition and subtraction operations.", - "kind": "problem", - "name": "Expressions of essentially character type shall not be used inappropriately in addition and", - "precision": "very-high", - "severity": "error", - "short_name": "ExpressionsOfEssentiallyCharacterTypeUse", - "tags": [] - } - ], - "title": "Expressions of essentially character type shall not be used inappropriately in addition and subtraction operations" - }, - "RULE-10-3": { - "properties": { - "obligation": "required" - }, - "queries": [ - { - "description": "The value of an expression shall not be assigned to an object with a narrower essential type or of a different essential type category.", - "kind": "problem", - "name": "The value of an expression shall not be assigned to an object with a narrower essential type or of a", - "precision": "high", - "severity": "error", - "short_name": "ValueOfAnExpressionAssignedToAnObjectWit", - "tags": [] - } - ], - "title": "The value of an expression shall not be assigned to an object with a narrower essential type or of a different essential type category" - }, - "RULE-10-4": { - "properties": { - "obligation": "required" - }, - "queries": [ - { - "description": "Both operands of an operator in which the usual arithmetic conversions are performed shall have the same essential type category.", - "kind": "problem", - "name": "Both operands of an operator in which the usual arithmetic conversions are performed shall have the", - "precision": "very-high", - "severity": "error", - "short_name": "BothOperandsOfAnOperatorInWhichT", - "tags": [] - } - ], - "title": "Both operands of an operator in which the usual arithmetic conversions are performed shall have the same essential type category" - }, - "RULE-10-5": { - "properties": { - "obligation": "advisory" - }, - "queries": [ - { - "description": "TODO.", - "kind": "problem", - "name": "The value of an expression should not be cast to an inappropriate essential type", - "precision": "very-high", - "severity": "error", - "short_name": "ValueOfAnExpressionShouldNotBe", - "tags": [] - } - ], - "title": "The value of an expression should not be cast to an inappropriate essential type" - }, - "RULE-10-6": { - "properties": { - "obligation": "required" - }, - "queries": [ - { - "description": "TODO.", - "kind": "problem", - "name": "The value of a composite expression shall not be assigned to an object with wider essential type", - "precision": "very-high", - "severity": "error", - "short_name": "ValueOfACompositeExpressionA", - "tags": [] - } - ], - "title": "The value of a composite expression shall not be assigned to an object with wider essential type" - }, - "RULE-10-7": { - "properties": { - "obligation": "required" - }, - "queries": [ - { - "description": "If a composite expression is used as one operand of an operator in which the usual arithmetic conversions are performed then the other operand shall not have wider essential type.", - "kind": "problem", - "name": "If a composite expression is used as one operand of an operator in which the usual arithmetic", - "precision": "very-high", - "severity": "error", - "short_name": "IfACompositeExpressionIsUsedAsOneOperandO", - "tags": [] - } - ], - "title": "If a composite expression is used as one operand of an operator in which the usual arithmetic conversions are performed then the other operand shall not have wider essential type" - }, - "RULE-10-8": { - "properties": { - "obligation": "required" - }, - "queries": [ - { - "description": "The value of a composite expression shall not be cast to a different essential type category or a wider essential type.", - "kind": "problem", - "name": "The value of a composite expression shall not be cast to a different essential type category or a", - "precision": "very-high", - "severity": "error", - "short_name": "ValueOfACompositeExpressionCastTo", - "tags": [] - } - ], - "title": "The value of a composite expression shall not be cast to a different essential type category or a wider essential type" - }, - "RULE-12-4": { - "properties": { - "obligation": "advisory" - }, - "queries": [ - { - "description": "TODO.", - "kind": "problem", - "name": "Evaluation of constant expressions should not lead to unsigned integer wrap-around", - "precision": "very-high", - "severity": "error", - "short_name": "EvaluationOfConstantExpres", - "tags": [] - } - ], - "title": "Evaluation of constant expressions should not lead to unsigned integer wrap-around" - }, - "RULE-12-5": { - "properties": { - "obligation": "mandatory" - }, - "queries": [ - { - "description": "Using sizeof operator on an array type function parameter leads to unintended results.", - "kind": "problem", - "name": "The sizeof operator should not be used on an array type function parameter", - "precision": "very-high", - "severity": "error", - "short_name": "SizeofOperatorUsedOnArrayTypeParam", - "tags": [] - } - ], - "title": "The sizeof operator shall not have an operand which is a function parameter declared as 'array of type'" - }, - "RULE-14-1": { - "properties": { - "obligation": "required" - }, - "queries": [ - { - "description": "TODO.", - "kind": "problem", - "name": "A loop counter shall not have essentially floating type", - "precision": "high", - "severity": "error", - "short_name": "LoopCounterHaveEssentiallyFloatingType", - "tags": [] - } - ], - "title": "A loop counter shall not have essentially floating type" - }, - "RULE-21-13": { - "properties": { - "obligation": "mandatory" - }, - "queries": [ - { - "description": "Any value passed to a function in shall be representable as an unsigned char or be the value EOF.", - "kind": "problem", - "name": "Any value passed to a function in shall be representable as an unsigned char or be the", - "precision": "very-high", - "severity": "error", - "short_name": "ValuePassedToAFunctionInCtypehN", - "tags": [] - } - ], - "title": "Any value passed to a function in shall be representable as an unsigned char or be the value EOF" - }, - "RULE-21-14": { - "properties": { - "obligation": "required" - }, - "queries": [ - { - "description": "TODO.", - "kind": "problem", - "name": "The Standard Library function memcmp shall not be used to compare null terminated strings", - "precision": "high", - "severity": "error", - "short_name": "StandardLibraryFunctionMemcmp", - "tags": [] - } - ], - "title": "The Standard Library function memcmp shall not be used to compare null terminated strings" - }, - "RULE-21-15": { - "properties": { - "obligation": "required" - }, - "queries": [ - { - "description": "The pointer arguments to the Standard Library functions memcpy, memmove and memcmp shall be pointers to qualified or unqualified versions of compatible types.", - "kind": "problem", - "name": "The pointer arguments to the Standard Library functions memcpy, memmove and memcmp shall be pointers", - "precision": "very-high", - "severity": "error", - "short_name": "PointerArgumentsToTheStandardLibraryFunctionsM", - "tags": [] - } - ], - "title": "The pointer arguments to the Standard Library functions memcpy, memmove and memcmp shall be pointers to qualified or unqualified versions of compatible types" - }, - "RULE-21-16": { - "properties": { - "obligation": "required" - }, - "queries": [ - { - "description": "The pointer arguments to the Standard Library function memcmp shall point to either a pointer type, an essentially signed type, an essentially unsigned type, an essentially Boolean type or an essentially enum type.", - "kind": "problem", - "name": "The pointer arguments to the Standard Library function memcmp shall point to either a pointer type,", - "precision": "very-high", - "severity": "error", - "short_name": "PointerArgumentsToTheStandardLibraryFunctionM", - "tags": [] - } - ], - "title": "The pointer arguments to the Standard Library function memcmp shall point to either a pointer type, an essentially signed type, an essentially unsigned type, an essentially Boolean type or an essentially enum type" - }, - "RULE-7-4": { - "properties": { - "obligation": "required" - }, - "queries": [ - { - "description": "Assigning string literal to a variable with type other than a pointer to const char and modifying it causes undefined behavior .", - "kind": "problem", - "name": "A string literal shall only be assigned to a pointer to const char", - "precision": "very-high", - "severity": "error", - "short_name": "StringLiteralAssignedToNonConstChar", - "tags": [] - } - ], - "title": "A string literal shall not be assigned to an object unless the object's type is 'pointer to const-qualified char'" - } - } -} \ No newline at end of file diff --git a/rules.csv b/rules.csv index 29bd7f2038..bd62b08063 100644 --- a/rules.csv +++ b/rules.csv @@ -552,9 +552,9 @@ c,CERT-C,INT30-C,Yes,Rule,,,Ensure that unsigned integer operations do not wrap, c,CERT-C,INT31-C,Yes,Rule,,,Ensure that integer conversions do not result in lost or misinterpreted data,A4-7-1,Types,Hard, c,CERT-C,INT32-C,Yes,Rule,,,Ensure that operations on signed integers do not result in overflow,A4-7-1,Types,Hard, c,CERT-C,INT33-C,Yes,Rule,,,Ensure that division and remainder operations do not result in divide-by-zero errors,,Types,Hard, -c,CERT-C,INT34-C,Yes,Rule,,,Do not shift an expression by a negative number of bits or by greater than or equal to the number of bits that exist in the operand,M5-8-1,Types,Import, +c,CERT-C,INT34-C,Yes,Rule,,,Do not shift an expression by a negative number of bits or by greater than or equal to the number of bits that exist in the operand,M5-8-1,Types1,Import, c,CERT-C,INT35-C,Yes,Rule,,,Use correct integer precisions,,Types,Hard, -c,CERT-C,INT36-C,Yes,Rule,,,Converting a pointer to integer or integer to pointer,M5-2-9,Types,Easy, +c,CERT-C,INT36-C,Yes,Rule,,,Converting a pointer to integer or integer to pointer,M5-2-9,Types1,Easy, c,CERT-C,MEM30-C,Yes,Rule,,,Do not access freed memory,MEM50-CPP,InvalidMemory1,Import, c,CERT-C,MEM31-C,Yes,Rule,,,Free dynamically allocated memory when no longer needed,,Memory2,Very Hard, c,CERT-C,MEM33-C,Yes,Rule,,,Allocate and copy structures containing a flexible array member dynamically,,Memory2,Very Hard, @@ -607,7 +607,7 @@ c,MISRA-C-2012,DIR-4-2,Yes,Advisory,,,All usage of assembly language should be d c,MISRA-C-2012,DIR-4-3,Yes,Required,,,Assembly language shall be encapsulated and isolated,,Language1,Medium, c,MISRA-C-2012,DIR-4-4,Yes,Advisory,,,Sections of code should not be commented out,A2-7-2,Syntax,Import, c,MISRA-C-2012,DIR-4-5,Yes,Advisory,,,Identifiers in the same name space with overlapping visibility should be typographically unambiguous,M2-10-1,Syntax,Easy, -c,MISRA-C-2012,DIR-4-6,Yes,Advisory,,,typedefs that indicate size and signedness should be used in place of the basic numerical types,,Types,Hard, +c,MISRA-C-2012,DIR-4-6,Yes,Advisory,,,typedefs that indicate size and signedness should be used in place of the basic numerical types,,Types1,Hard, c,MISRA-C-2012,DIR-4-7,Yes,Required,,,"If a function returns error information, then that error information shall be tested",M0-3-2,Contracts,Import, c,MISRA-C-2012,DIR-4-8,Yes,Advisory,,,"If a pointer to a structure or union is never dereferenced within a translation unit, then the implementation of the object should be hidden",,Pointers1,Medium, c,MISRA-C-2012,DIR-4-9,Yes,Advisory,,,A function should be used in preference to a function-like macro where they are interchangeable,,Preprocessor6,Medium,Audit @@ -645,7 +645,7 @@ c,MISRA-C-2012,RULE-6-2,Yes,Required,,,Single-bit named bit fields shall not be c,MISRA-C-2012,RULE-7-1,Yes,Required,,,Octal constants shall not be used,M2-13-2,Banned,Import, c,MISRA-C-2012,RULE-7-2,Yes,Required,,,A �u� or �U� suffix shall be applied to all integer constants that are represented in an unsigned type,M2-13-3,Syntax,Easy, c,MISRA-C-2012,RULE-7-3,Yes,Required,,,The lowercase character �l� shall not be used in a literal suffix,M2-13-4,Syntax,Easy, -c,MISRA-C-2012,RULE-7-4,Yes,Required,,,A string literal shall not be assigned to an object unless the object�s type is �pointer to const-qualified char�,A2-13-4,Types,Easy, +c,MISRA-C-2012,RULE-7-4,Yes,Required,,,A string literal shall not be assigned to an object unless the object�s type is �pointer to const-qualified char�,A2-13-4,Types1,Easy, c,MISRA-C-2012,RULE-8-1,Yes,Required,,,Types shall be explicitly specified,,Declarations3,Medium, c,MISRA-C-2012,RULE-8-2,Yes,Required,,,Function types shall be in prototype form with named parameters,,Declarations4,Medium, c,MISRA-C-2012,RULE-8-3,Yes,Required,,,All declarations of an object or function shall use the same names and type qualifiers,M3-2-1,Declarations4,Medium, @@ -686,7 +686,7 @@ c,MISRA-C-2012,RULE-12-1,Yes,Advisory,,,The precedence of operators within expre c,MISRA-C-2012,RULE-12-2,Yes,Required,,,The right hand operand of a shift operator shall lie in the range zero to one less than the width in bits of the essential type of the left hand operand,,Contracts,Medium, c,MISRA-C-2012,RULE-12-3,Yes,Advisory,,,The comma operator should not be used,M5-18-1,Banned,Import, c,MISRA-C-2012,RULE-12-4,Yes,Advisory,,,Evaluation of constant expressions should not lead to unsigned integer wrap-around,INT30-C,Types,Easy, -c,MISRA-C-2012,RULE-12-5,Yes,Mandatory,,,The sizeof operator shall not have an operand which is a function parameter declared as �array of type�,,Types,Medium, +c,MISRA-C-2012,RULE-12-5,Yes,Mandatory,,,The sizeof operator shall not have an operand which is a function parameter declared as �array of type�,,Types1,Medium, c,MISRA-C-2012,RULE-13-1,Yes,Required,,,Initializer lists shall not contain persistent side effects,,SideEffects1,Medium, c,MISRA-C-2012,RULE-13-2,Yes,Required,,,The value of an expression and its persistent side effects shall be the same under all permitted evaluation orders,PRE31-C,SideEffects,Medium, c,MISRA-C-2012,RULE-13-3,Yes,Advisory,,,A full expression containing an increment (++) or decrement (--) operator should have no other potential side effects other than that caused by the increment or decrement operator,,SideEffects2,Medium, From 7a6fb0b21a68bcd71635be895a846c607ab58799 Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Thu, 23 Mar 2023 19:09:31 -0700 Subject: [PATCH 43/53] Add missing metadata files --- .../cpp/exclusions/c/Types1.qll | 95 +++++++++++++++++++ rule_packages/c/Types1.json | 91 ++++++++++++++++++ 2 files changed, 186 insertions(+) create mode 100644 cpp/common/src/codingstandards/cpp/exclusions/c/Types1.qll create mode 100644 rule_packages/c/Types1.json diff --git a/cpp/common/src/codingstandards/cpp/exclusions/c/Types1.qll b/cpp/common/src/codingstandards/cpp/exclusions/c/Types1.qll new file mode 100644 index 0000000000..ab7333b4c0 --- /dev/null +++ b/cpp/common/src/codingstandards/cpp/exclusions/c/Types1.qll @@ -0,0 +1,95 @@ +//** THIS FILE IS AUTOGENERATED, DO NOT MODIFY DIRECTLY. **/ +import cpp +import RuleMetadata +import codingstandards.cpp.exclusions.RuleMetadata + +newtype Types1Query = + TExprShiftedbyNegativeOrGreaterPrecisionOperandQuery() or + TConvertingAPointerToIntegerOrIntegerToPointerQuery() or + TPlainNumericalTypeUsedOverExplicitTypedefQuery() or + TSizeofOperatorUsedOnArrayTypeParamQuery() or + TStringLiteralAssignedToNonConstCharQuery() + +predicate isTypes1QueryMetadata(Query query, string queryId, string ruleId, string category) { + query = + // `Query` instance for the `exprShiftedbyNegativeOrGreaterPrecisionOperand` query + Types1Package::exprShiftedbyNegativeOrGreaterPrecisionOperandQuery() and + queryId = + // `@id` for the `exprShiftedbyNegativeOrGreaterPrecisionOperand` query + "c/cert/expr-shiftedby-negative-or-greater-precision-operand" and + ruleId = "INT34-C" and + category = "rule" + or + query = + // `Query` instance for the `convertingAPointerToIntegerOrIntegerToPointer` query + Types1Package::convertingAPointerToIntegerOrIntegerToPointerQuery() and + queryId = + // `@id` for the `convertingAPointerToIntegerOrIntegerToPointer` query + "c/cert/converting-a-pointer-to-integer-or-integer-to-pointer" and + ruleId = "INT36-C" and + category = "rule" + or + query = + // `Query` instance for the `plainNumericalTypeUsedOverExplicitTypedef` query + Types1Package::plainNumericalTypeUsedOverExplicitTypedefQuery() and + queryId = + // `@id` for the `plainNumericalTypeUsedOverExplicitTypedef` query + "c/misra/plain-numerical-type-used-over-explicit-typedef" and + ruleId = "DIR-4-6" and + category = "advisory" + or + query = + // `Query` instance for the `sizeofOperatorUsedOnArrayTypeParam` query + Types1Package::sizeofOperatorUsedOnArrayTypeParamQuery() and + queryId = + // `@id` for the `sizeofOperatorUsedOnArrayTypeParam` query + "c/misra/sizeof-operator-used-on-array-type-param" and + ruleId = "RULE-12-5" and + category = "mandatory" + or + query = + // `Query` instance for the `stringLiteralAssignedToNonConstChar` query + Types1Package::stringLiteralAssignedToNonConstCharQuery() and + queryId = + // `@id` for the `stringLiteralAssignedToNonConstChar` query + "c/misra/string-literal-assigned-to-non-const-char" and + ruleId = "RULE-7-4" and + category = "required" +} + +module Types1Package { + Query exprShiftedbyNegativeOrGreaterPrecisionOperandQuery() { + //autogenerate `Query` type + result = + // `Query` type for `exprShiftedbyNegativeOrGreaterPrecisionOperand` query + TQueryC(TTypes1PackageQuery(TExprShiftedbyNegativeOrGreaterPrecisionOperandQuery())) + } + + Query convertingAPointerToIntegerOrIntegerToPointerQuery() { + //autogenerate `Query` type + result = + // `Query` type for `convertingAPointerToIntegerOrIntegerToPointer` query + TQueryC(TTypes1PackageQuery(TConvertingAPointerToIntegerOrIntegerToPointerQuery())) + } + + Query plainNumericalTypeUsedOverExplicitTypedefQuery() { + //autogenerate `Query` type + result = + // `Query` type for `plainNumericalTypeUsedOverExplicitTypedef` query + TQueryC(TTypes1PackageQuery(TPlainNumericalTypeUsedOverExplicitTypedefQuery())) + } + + Query sizeofOperatorUsedOnArrayTypeParamQuery() { + //autogenerate `Query` type + result = + // `Query` type for `sizeofOperatorUsedOnArrayTypeParam` query + TQueryC(TTypes1PackageQuery(TSizeofOperatorUsedOnArrayTypeParamQuery())) + } + + Query stringLiteralAssignedToNonConstCharQuery() { + //autogenerate `Query` type + result = + // `Query` type for `stringLiteralAssignedToNonConstChar` query + TQueryC(TTypes1PackageQuery(TStringLiteralAssignedToNonConstCharQuery())) + } +} diff --git a/rule_packages/c/Types1.json b/rule_packages/c/Types1.json new file mode 100644 index 0000000000..fae0339d3c --- /dev/null +++ b/rule_packages/c/Types1.json @@ -0,0 +1,91 @@ +{ + "CERT-C": { + "INT34-C": { + "properties": { + "obligation": "rule" + }, + "queries": [ + { + "description": "Shifting an expression by an operand that is negative or of precision greater or equal to that or the another causes representational error.", + "kind": "problem", + "name": "Bit shift should not be done by a negative operand or an operand of greater-or-equal precision than that of another", + "precision": "very-high", + "severity": "error", + "short_name": "ExprShiftedbyNegativeOrGreaterPrecisionOperand", + "tags": [] + } + ], + "title": "Do not shift an expression by a negative number of bits or by greater than or equal to the number of bits that exist in the operand" + }, + "INT36-C": { + "properties": { + "obligation": "rule" + }, + "queries": [ + { + "description": "Converting between pointers and integers is not portable and might cause invalid memory access.", + "kind": "problem", + "name": "Do not convert pointers to integers and back", + "precision": "very-high", + "severity": "error", + "short_name": "ConvertingAPointerToIntegerOrIntegerToPointer", + "tags": [] + } + ], + "title": "Converting a pointer to integer or integer to pointer" + } + }, + "MISRA-C-2012": { + "DIR-4-6": { + "properties": { + "obligation": "advisory" + }, + "queries": [ + { + "description": "Using plain numerical types over typedefs with explicit sign and bit counts may lead to confusion on how much bits are allocated for a value.", + "kind": "problem", + "name": "Do not use plain numerical types over typedefs named after their explicit bit layout", + "precision": "high", + "severity": "error", + "short_name": "PlainNumericalTypeUsedOverExplicitTypedef", + "tags": [] + } + ], + "title": "typedefs that indicate size and signedness should be used in place of the basic numerical types" + }, + "RULE-12-5": { + "properties": { + "obligation": "mandatory" + }, + "queries": [ + { + "description": "Using sizeof operator on an array type function parameter leads to unintended results.", + "kind": "problem", + "name": "The sizeof operator should not be used on an array type function parameter", + "precision": "very-high", + "severity": "error", + "short_name": "SizeofOperatorUsedOnArrayTypeParam", + "tags": [] + } + ], + "title": "The sizeof operator shall not have an operand which is a function parameter declared as 'array of type'" + }, + "RULE-7-4": { + "properties": { + "obligation": "required" + }, + "queries": [ + { + "description": "Assigning string literal to a variable with type other than a pointer to const char and modifying it causes undefined behavior .", + "kind": "problem", + "name": "A string literal shall only be assigned to a pointer to const char", + "precision": "very-high", + "severity": "error", + "short_name": "StringLiteralAssignedToNonConstChar", + "tags": [] + } + ], + "title": "A string literal shall not be assigned to an object unless the object's type is 'pointer to const-qualified char'" + } + } +} From 08956e147f04309bc429122578e4e6029ee187ba Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Thu, 23 Mar 2023 19:15:37 -0700 Subject: [PATCH 44/53] Add parameter name to INT34-C popcount --- c/cert/test/rules/INT34-C/test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/cert/test/rules/INT34-C/test.c b/c/cert/test/rules/INT34-C/test.c index 44f2b28e70..c47df4b55d 100644 --- a/c/cert/test/rules/INT34-C/test.c +++ b/c/cert/test/rules/INT34-C/test.c @@ -2,7 +2,7 @@ #include #include -extern size_t popcount(uintmax_t){}; +extern size_t popcount(uintmax_t x){}; #define PRECISION(x) popcount(x) int main() { From 97a33e4e6ada2d12185c41203b5decb88f13b5eb Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Fri, 24 Mar 2023 10:06:39 -0700 Subject: [PATCH 45/53] Update .expected for INT34-C --- ...NegativeOrGreaterPrecisionOperand.expected | 518 ++++++++---------- 1 file changed, 243 insertions(+), 275 deletions(-) diff --git a/c/cert/test/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.expected b/c/cert/test/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.expected index f7d45166f3..5ac7e8a05a 100644 --- a/c/cert/test/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.expected +++ b/c/cert/test/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.expected @@ -1,275 +1,243 @@ -| test.c:20:3:20:10 | ... << ... | The operand x0 is shifted by an expression x0 which is greater than or equal to in precision. | -| test.c:23:3:23:10 | ... << ... | The operand x0 is shifted by an expression x3 which is greater than or equal to in precision. | -| test.c:24:3:24:10 | ... << ... | The operand x0 is shifted by an expression x4 which is greater than or equal to in precision. | -| test.c:25:3:25:10 | ... << ... | The operand x0 is shifted by an expression x5 which is greater than or equal to in precision. | -| test.c:26:3:26:10 | ... << ... | The operand x0 is shifted by an expression x6 which is greater than or equal to in precision. | -| test.c:27:3:27:10 | ... << ... | The operand x0 is shifted by an expression x7 which is greater than or equal to in precision. | -| test.c:28:3:28:10 | ... << ... | The operand x0 is shifted by an expression x8 which is greater than or equal to in precision. | -| test.c:29:3:29:10 | ... << ... | The operand x0 is shifted by an expression x9 which is greater than or equal to in precision. | -| test.c:30:3:30:11 | ... << ... | The operand x0 is shifted by an expression x10 which is greater than or equal to in precision. | -| test.c:31:3:31:11 | ... << ... | The operand x0 is shifted by an expression x11 which is greater than or equal to in precision. | -| test.c:32:3:32:11 | ... << ... | The operand x0 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:33:3:33:11 | ... << ... | The operand x0 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:34:3:34:11 | ... << ... | The operand x0 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:35:3:35:10 | ... << ... | The operand x1 is shifted by an expression x0 which is greater than or equal to in precision. | -| test.c:36:3:36:10 | ... << ... | The operand x1 is shifted by an expression x1 which is greater than or equal to in precision. | -| test.c:37:3:37:10 | ... << ... | The operand x1 is shifted by an expression x2 which is greater than or equal to in precision. | -| test.c:38:3:38:10 | ... << ... | The operand x1 is shifted by an expression x3 which is greater than or equal to in precision. | -| test.c:39:3:39:10 | ... << ... | The operand x1 is shifted by an expression x4 which is greater than or equal to in precision. | -| test.c:40:3:40:10 | ... << ... | The operand x1 is shifted by an expression x5 which is greater than or equal to in precision. | -| test.c:41:3:41:10 | ... << ... | The operand x1 is shifted by an expression x6 which is greater than or equal to in precision. | -| test.c:42:3:42:10 | ... << ... | The operand x1 is shifted by an expression x7 which is greater than or equal to in precision. | -| test.c:43:3:43:10 | ... << ... | The operand x1 is shifted by an expression x8 which is greater than or equal to in precision. | -| test.c:44:3:44:10 | ... << ... | The operand x1 is shifted by an expression x9 which is greater than or equal to in precision. | -| test.c:45:3:45:11 | ... << ... | The operand x1 is shifted by an expression x10 which is greater than or equal to in precision. | -| test.c:46:3:46:11 | ... << ... | The operand x1 is shifted by an expression x11 which is greater than or equal to in precision. | -| test.c:47:3:47:11 | ... << ... | The operand x1 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:48:3:48:11 | ... << ... | The operand x1 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:49:3:49:11 | ... << ... | The operand x1 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:50:3:50:10 | ... << ... | The operand x2 is shifted by an expression x0 which is greater than or equal to in precision. | -| test.c:51:3:51:10 | ... << ... | The operand x2 is shifted by an expression x1 which is greater than or equal to in precision. | -| test.c:52:3:52:10 | ... << ... | The operand x2 is shifted by an expression x2 which is greater than or equal to in precision. | -| test.c:53:3:53:10 | ... << ... | The operand x2 is shifted by an expression x3 which is greater than or equal to in precision. | -| test.c:54:3:54:10 | ... << ... | The operand x2 is shifted by an expression x4 which is greater than or equal to in precision. | -| test.c:55:3:55:10 | ... << ... | The operand x2 is shifted by an expression x5 which is greater than or equal to in precision. | -| test.c:56:3:56:10 | ... << ... | The operand x2 is shifted by an expression x6 which is greater than or equal to in precision. | -| test.c:57:3:57:10 | ... << ... | The operand x2 is shifted by an expression x7 which is greater than or equal to in precision. | -| test.c:58:3:58:10 | ... << ... | The operand x2 is shifted by an expression x8 which is greater than or equal to in precision. | -| test.c:59:3:59:10 | ... << ... | The operand x2 is shifted by an expression x9 which is greater than or equal to in precision. | -| test.c:60:3:60:11 | ... << ... | The operand x2 is shifted by an expression x10 which is greater than or equal to in precision. | -| test.c:61:3:61:11 | ... << ... | The operand x2 is shifted by an expression x11 which is greater than or equal to in precision. | -| test.c:62:3:62:11 | ... << ... | The operand x2 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:63:3:63:11 | ... << ... | The operand x2 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:64:3:64:11 | ... << ... | The operand x2 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:68:3:68:10 | ... << ... | The operand x3 is shifted by an expression x3 which is greater than or equal to in precision. | -| test.c:71:3:71:10 | ... << ... | The operand x3 is shifted by an expression x6 which is greater than or equal to in precision. | -| test.c:72:3:72:10 | ... << ... | The operand x3 is shifted by an expression x7 which is greater than or equal to in precision. | -| test.c:73:3:73:10 | ... << ... | The operand x3 is shifted by an expression x8 which is greater than or equal to in precision. | -| test.c:74:3:74:10 | ... << ... | The operand x3 is shifted by an expression x9 which is greater than or equal to in precision. | -| test.c:75:3:75:11 | ... << ... | The operand x3 is shifted by an expression x10 which is greater than or equal to in precision. | -| test.c:76:3:76:11 | ... << ... | The operand x3 is shifted by an expression x11 which is greater than or equal to in precision. | -| test.c:77:3:77:11 | ... << ... | The operand x3 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:78:3:78:11 | ... << ... | The operand x3 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:79:3:79:11 | ... << ... | The operand x3 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:83:3:83:10 | ... << ... | The operand x4 is shifted by an expression x3 which is greater than or equal to in precision. | -| test.c:84:3:84:10 | ... << ... | The operand x4 is shifted by an expression x4 which is greater than or equal to in precision. | -| test.c:85:3:85:10 | ... << ... | The operand x4 is shifted by an expression x5 which is greater than or equal to in precision. | -| test.c:86:3:86:10 | ... << ... | The operand x4 is shifted by an expression x6 which is greater than or equal to in precision. | -| test.c:87:3:87:10 | ... << ... | The operand x4 is shifted by an expression x7 which is greater than or equal to in precision. | -| test.c:88:3:88:10 | ... << ... | The operand x4 is shifted by an expression x8 which is greater than or equal to in precision. | -| test.c:89:3:89:10 | ... << ... | The operand x4 is shifted by an expression x9 which is greater than or equal to in precision. | -| test.c:90:3:90:11 | ... << ... | The operand x4 is shifted by an expression x10 which is greater than or equal to in precision. | -| test.c:91:3:91:11 | ... << ... | The operand x4 is shifted by an expression x11 which is greater than or equal to in precision. | -| test.c:92:3:92:11 | ... << ... | The operand x4 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:93:3:93:11 | ... << ... | The operand x4 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:94:3:94:11 | ... << ... | The operand x4 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:98:3:98:10 | ... << ... | The operand x5 is shifted by an expression x3 which is greater than or equal to in precision. | -| test.c:99:3:99:10 | ... << ... | The operand x5 is shifted by an expression x4 which is greater than or equal to in precision. | -| test.c:100:3:100:10 | ... << ... | The operand x5 is shifted by an expression x5 which is greater than or equal to in precision. | -| test.c:101:3:101:10 | ... << ... | The operand x5 is shifted by an expression x6 which is greater than or equal to in precision. | -| test.c:102:3:102:10 | ... << ... | The operand x5 is shifted by an expression x7 which is greater than or equal to in precision. | -| test.c:103:3:103:10 | ... << ... | The operand x5 is shifted by an expression x8 which is greater than or equal to in precision. | -| test.c:104:3:104:10 | ... << ... | The operand x5 is shifted by an expression x9 which is greater than or equal to in precision. | -| test.c:105:3:105:11 | ... << ... | The operand x5 is shifted by an expression x10 which is greater than or equal to in precision. | -| test.c:106:3:106:11 | ... << ... | The operand x5 is shifted by an expression x11 which is greater than or equal to in precision. | -| test.c:107:3:107:11 | ... << ... | The operand x5 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:108:3:108:11 | ... << ... | The operand x5 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:109:3:109:11 | ... << ... | The operand x5 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:116:3:116:10 | ... << ... | The operand x6 is shifted by an expression x6 which is greater than or equal to in precision. | -| test.c:119:3:119:10 | ... << ... | The operand x6 is shifted by an expression x9 which is greater than or equal to in precision. | -| test.c:122:3:122:11 | ... << ... | The operand x6 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:123:3:123:11 | ... << ... | The operand x6 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:124:3:124:11 | ... << ... | The operand x6 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:131:3:131:10 | ... << ... | The operand x7 is shifted by an expression x6 which is greater than or equal to in precision. | -| test.c:132:3:132:10 | ... << ... | The operand x7 is shifted by an expression x7 which is greater than or equal to in precision. | -| test.c:133:3:133:10 | ... << ... | The operand x7 is shifted by an expression x8 which is greater than or equal to in precision. | -| test.c:134:3:134:10 | ... << ... | The operand x7 is shifted by an expression x9 which is greater than or equal to in precision. | -| test.c:135:3:135:11 | ... << ... | The operand x7 is shifted by an expression x10 which is greater than or equal to in precision. | -| test.c:136:3:136:11 | ... << ... | The operand x7 is shifted by an expression x11 which is greater than or equal to in precision. | -| test.c:137:3:137:11 | ... << ... | The operand x7 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:138:3:138:11 | ... << ... | The operand x7 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:139:3:139:11 | ... << ... | The operand x7 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:146:3:146:10 | ... << ... | The operand x8 is shifted by an expression x6 which is greater than or equal to in precision. | -| test.c:147:3:147:10 | ... << ... | The operand x8 is shifted by an expression x7 which is greater than or equal to in precision. | -| test.c:148:3:148:10 | ... << ... | The operand x8 is shifted by an expression x8 which is greater than or equal to in precision. | -| test.c:149:3:149:10 | ... << ... | The operand x8 is shifted by an expression x9 which is greater than or equal to in precision. | -| test.c:150:3:150:11 | ... << ... | The operand x8 is shifted by an expression x10 which is greater than or equal to in precision. | -| test.c:151:3:151:11 | ... << ... | The operand x8 is shifted by an expression x11 which is greater than or equal to in precision. | -| test.c:152:3:152:11 | ... << ... | The operand x8 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:153:3:153:11 | ... << ... | The operand x8 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:154:3:154:11 | ... << ... | The operand x8 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:161:3:161:10 | ... << ... | The operand x9 is shifted by an expression x6 which is greater than or equal to in precision. | -| test.c:164:3:164:10 | ... << ... | The operand x9 is shifted by an expression x9 which is greater than or equal to in precision. | -| test.c:167:3:167:11 | ... << ... | The operand x9 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:168:3:168:11 | ... << ... | The operand x9 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:169:3:169:11 | ... << ... | The operand x9 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:176:3:176:11 | ... << ... | The operand x10 is shifted by an expression x6 which is greater than or equal to in precision. | -| test.c:177:3:177:11 | ... << ... | The operand x10 is shifted by an expression x7 which is greater than or equal to in precision. | -| test.c:178:3:178:11 | ... << ... | The operand x10 is shifted by an expression x8 which is greater than or equal to in precision. | -| test.c:179:3:179:11 | ... << ... | The operand x10 is shifted by an expression x9 which is greater than or equal to in precision. | -| test.c:180:3:180:12 | ... << ... | The operand x10 is shifted by an expression x10 which is greater than or equal to in precision. | -| test.c:182:3:182:12 | ... << ... | The operand x10 is shifted by an expression x11 which is greater than or equal to in precision. | -| test.c:184:3:184:12 | ... << ... | The operand x10 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:186:3:186:12 | ... << ... | The operand x10 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:188:3:188:12 | ... << ... | The operand x10 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:196:3:196:11 | ... << ... | The operand x11 is shifted by an expression x6 which is greater than or equal to in precision. | -| test.c:197:3:197:11 | ... << ... | The operand x11 is shifted by an expression x7 which is greater than or equal to in precision. | -| test.c:198:3:198:11 | ... << ... | The operand x11 is shifted by an expression x8 which is greater than or equal to in precision. | -| test.c:199:3:199:11 | ... << ... | The operand x11 is shifted by an expression x9 which is greater than or equal to in precision. | -| test.c:200:3:200:12 | ... << ... | The operand x11 is shifted by an expression x10 which is greater than or equal to in precision. | -| test.c:202:3:202:12 | ... << ... | The operand x11 is shifted by an expression x11 which is greater than or equal to in precision. | -| test.c:204:3:204:12 | ... << ... | The operand x11 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:206:3:206:12 | ... << ... | The operand x11 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:208:3:208:12 | ... << ... | The operand x11 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:222:3:222:12 | ... << ... | The operand x12 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:238:3:238:12 | ... << ... | The operand x13 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:240:3:240:12 | ... << ... | The operand x13 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:242:3:242:12 | ... << ... | The operand x13 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:256:3:256:12 | ... << ... | The operand x14 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:258:3:258:12 | ... << ... | The operand x14 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:260:3:260:12 | ... << ... | The operand x14 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:265:3:265:10 | ... >> ... | The operand x0 is shifted by an expression x0 which is greater than or equal to in precision. | -| test.c:268:3:268:10 | ... >> ... | The operand x0 is shifted by an expression x3 which is greater than or equal to in precision. | -| test.c:269:3:269:10 | ... >> ... | The operand x0 is shifted by an expression x4 which is greater than or equal to in precision. | -| test.c:270:3:270:10 | ... >> ... | The operand x0 is shifted by an expression x5 which is greater than or equal to in precision. | -| test.c:271:3:271:10 | ... >> ... | The operand x0 is shifted by an expression x6 which is greater than or equal to in precision. | -| test.c:272:3:272:10 | ... >> ... | The operand x0 is shifted by an expression x7 which is greater than or equal to in precision. | -| test.c:273:3:273:10 | ... >> ... | The operand x0 is shifted by an expression x8 which is greater than or equal to in precision. | -| test.c:274:3:274:10 | ... >> ... | The operand x0 is shifted by an expression x9 which is greater than or equal to in precision. | -| test.c:275:3:275:11 | ... >> ... | The operand x0 is shifted by an expression x10 which is greater than or equal to in precision. | -| test.c:276:3:276:11 | ... >> ... | The operand x0 is shifted by an expression x11 which is greater than or equal to in precision. | -| test.c:277:3:277:11 | ... >> ... | The operand x0 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:278:3:278:11 | ... >> ... | The operand x0 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:279:3:279:11 | ... >> ... | The operand x0 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:280:3:280:10 | ... >> ... | The operand x1 is shifted by an expression x0 which is greater than or equal to in precision. | -| test.c:281:3:281:10 | ... >> ... | The operand x1 is shifted by an expression x1 which is greater than or equal to in precision. | -| test.c:282:3:282:10 | ... >> ... | The operand x1 is shifted by an expression x2 which is greater than or equal to in precision. | -| test.c:283:3:283:10 | ... >> ... | The operand x1 is shifted by an expression x3 which is greater than or equal to in precision. | -| test.c:284:3:284:10 | ... >> ... | The operand x1 is shifted by an expression x4 which is greater than or equal to in precision. | -| test.c:285:3:285:10 | ... >> ... | The operand x1 is shifted by an expression x5 which is greater than or equal to in precision. | -| test.c:286:3:286:10 | ... >> ... | The operand x1 is shifted by an expression x6 which is greater than or equal to in precision. | -| test.c:287:3:287:10 | ... >> ... | The operand x1 is shifted by an expression x7 which is greater than or equal to in precision. | -| test.c:288:3:288:10 | ... >> ... | The operand x1 is shifted by an expression x8 which is greater than or equal to in precision. | -| test.c:289:3:289:10 | ... >> ... | The operand x1 is shifted by an expression x9 which is greater than or equal to in precision. | -| test.c:290:3:290:11 | ... >> ... | The operand x1 is shifted by an expression x10 which is greater than or equal to in precision. | -| test.c:291:3:291:11 | ... >> ... | The operand x1 is shifted by an expression x11 which is greater than or equal to in precision. | -| test.c:292:3:292:11 | ... >> ... | The operand x1 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:293:3:293:11 | ... >> ... | The operand x1 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:294:3:294:11 | ... >> ... | The operand x1 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:295:3:295:10 | ... >> ... | The operand x2 is shifted by an expression x0 which is greater than or equal to in precision. | -| test.c:296:3:296:10 | ... >> ... | The operand x2 is shifted by an expression x1 which is greater than or equal to in precision. | -| test.c:297:3:297:10 | ... >> ... | The operand x2 is shifted by an expression x2 which is greater than or equal to in precision. | -| test.c:298:3:298:10 | ... >> ... | The operand x2 is shifted by an expression x3 which is greater than or equal to in precision. | -| test.c:299:3:299:10 | ... >> ... | The operand x2 is shifted by an expression x4 which is greater than or equal to in precision. | -| test.c:300:3:300:10 | ... >> ... | The operand x2 is shifted by an expression x5 which is greater than or equal to in precision. | -| test.c:301:3:301:10 | ... >> ... | The operand x2 is shifted by an expression x6 which is greater than or equal to in precision. | -| test.c:302:3:302:10 | ... >> ... | The operand x2 is shifted by an expression x7 which is greater than or equal to in precision. | -| test.c:303:3:303:10 | ... >> ... | The operand x2 is shifted by an expression x8 which is greater than or equal to in precision. | -| test.c:304:3:304:10 | ... >> ... | The operand x2 is shifted by an expression x9 which is greater than or equal to in precision. | -| test.c:305:3:305:11 | ... >> ... | The operand x2 is shifted by an expression x10 which is greater than or equal to in precision. | -| test.c:306:3:306:11 | ... >> ... | The operand x2 is shifted by an expression x11 which is greater than or equal to in precision. | -| test.c:307:3:307:11 | ... >> ... | The operand x2 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:308:3:308:11 | ... >> ... | The operand x2 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:309:3:309:11 | ... >> ... | The operand x2 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:313:3:313:10 | ... >> ... | The operand x3 is shifted by an expression x3 which is greater than or equal to in precision. | -| test.c:316:3:316:10 | ... >> ... | The operand x3 is shifted by an expression x6 which is greater than or equal to in precision. | -| test.c:317:3:317:10 | ... >> ... | The operand x3 is shifted by an expression x7 which is greater than or equal to in precision. | -| test.c:318:3:318:10 | ... >> ... | The operand x3 is shifted by an expression x8 which is greater than or equal to in precision. | -| test.c:319:3:319:10 | ... >> ... | The operand x3 is shifted by an expression x9 which is greater than or equal to in precision. | -| test.c:320:3:320:11 | ... >> ... | The operand x3 is shifted by an expression x10 which is greater than or equal to in precision. | -| test.c:321:3:321:11 | ... >> ... | The operand x3 is shifted by an expression x11 which is greater than or equal to in precision. | -| test.c:322:3:322:11 | ... >> ... | The operand x3 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:323:3:323:11 | ... >> ... | The operand x3 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:324:3:324:11 | ... >> ... | The operand x3 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:328:3:328:10 | ... >> ... | The operand x4 is shifted by an expression x3 which is greater than or equal to in precision. | -| test.c:329:3:329:10 | ... >> ... | The operand x4 is shifted by an expression x4 which is greater than or equal to in precision. | -| test.c:330:3:330:10 | ... >> ... | The operand x4 is shifted by an expression x5 which is greater than or equal to in precision. | -| test.c:331:3:331:10 | ... >> ... | The operand x4 is shifted by an expression x6 which is greater than or equal to in precision. | -| test.c:332:3:332:10 | ... >> ... | The operand x4 is shifted by an expression x7 which is greater than or equal to in precision. | -| test.c:333:3:333:10 | ... >> ... | The operand x4 is shifted by an expression x8 which is greater than or equal to in precision. | -| test.c:334:3:334:10 | ... >> ... | The operand x4 is shifted by an expression x9 which is greater than or equal to in precision. | -| test.c:335:3:335:11 | ... >> ... | The operand x4 is shifted by an expression x10 which is greater than or equal to in precision. | -| test.c:336:3:336:11 | ... >> ... | The operand x4 is shifted by an expression x11 which is greater than or equal to in precision. | -| test.c:337:3:337:11 | ... >> ... | The operand x4 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:338:3:338:11 | ... >> ... | The operand x4 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:339:3:339:11 | ... >> ... | The operand x4 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:343:3:343:10 | ... >> ... | The operand x5 is shifted by an expression x3 which is greater than or equal to in precision. | -| test.c:344:3:344:10 | ... >> ... | The operand x5 is shifted by an expression x4 which is greater than or equal to in precision. | -| test.c:345:3:345:10 | ... >> ... | The operand x5 is shifted by an expression x5 which is greater than or equal to in precision. | -| test.c:346:3:346:10 | ... >> ... | The operand x5 is shifted by an expression x6 which is greater than or equal to in precision. | -| test.c:347:3:347:10 | ... >> ... | The operand x5 is shifted by an expression x7 which is greater than or equal to in precision. | -| test.c:348:3:348:10 | ... >> ... | The operand x5 is shifted by an expression x8 which is greater than or equal to in precision. | -| test.c:349:3:349:10 | ... >> ... | The operand x5 is shifted by an expression x9 which is greater than or equal to in precision. | -| test.c:350:3:350:11 | ... >> ... | The operand x5 is shifted by an expression x10 which is greater than or equal to in precision. | -| test.c:351:3:351:11 | ... >> ... | The operand x5 is shifted by an expression x11 which is greater than or equal to in precision. | -| test.c:352:3:352:11 | ... >> ... | The operand x5 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:353:3:353:11 | ... >> ... | The operand x5 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:354:3:354:11 | ... >> ... | The operand x5 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:361:3:361:10 | ... >> ... | The operand x6 is shifted by an expression x6 which is greater than or equal to in precision. | -| test.c:364:3:364:10 | ... >> ... | The operand x6 is shifted by an expression x9 which is greater than or equal to in precision. | -| test.c:367:3:367:11 | ... >> ... | The operand x6 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:368:3:368:11 | ... >> ... | The operand x6 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:369:3:369:11 | ... >> ... | The operand x6 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:376:3:376:10 | ... >> ... | The operand x7 is shifted by an expression x6 which is greater than or equal to in precision. | -| test.c:377:3:377:10 | ... >> ... | The operand x7 is shifted by an expression x7 which is greater than or equal to in precision. | -| test.c:378:3:378:10 | ... >> ... | The operand x7 is shifted by an expression x8 which is greater than or equal to in precision. | -| test.c:379:3:379:10 | ... >> ... | The operand x7 is shifted by an expression x9 which is greater than or equal to in precision. | -| test.c:380:3:380:11 | ... >> ... | The operand x7 is shifted by an expression x10 which is greater than or equal to in precision. | -| test.c:381:3:381:11 | ... >> ... | The operand x7 is shifted by an expression x11 which is greater than or equal to in precision. | -| test.c:382:3:382:11 | ... >> ... | The operand x7 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:383:3:383:11 | ... >> ... | The operand x7 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:384:3:384:11 | ... >> ... | The operand x7 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:391:3:391:10 | ... >> ... | The operand x8 is shifted by an expression x6 which is greater than or equal to in precision. | -| test.c:392:3:392:10 | ... >> ... | The operand x8 is shifted by an expression x7 which is greater than or equal to in precision. | -| test.c:393:3:393:10 | ... >> ... | The operand x8 is shifted by an expression x8 which is greater than or equal to in precision. | -| test.c:394:3:394:10 | ... >> ... | The operand x8 is shifted by an expression x9 which is greater than or equal to in precision. | -| test.c:395:3:395:11 | ... >> ... | The operand x8 is shifted by an expression x10 which is greater than or equal to in precision. | -| test.c:396:3:396:11 | ... >> ... | The operand x8 is shifted by an expression x11 which is greater than or equal to in precision. | -| test.c:397:3:397:11 | ... >> ... | The operand x8 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:398:3:398:11 | ... >> ... | The operand x8 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:399:3:399:11 | ... >> ... | The operand x8 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:406:3:406:10 | ... >> ... | The operand x9 is shifted by an expression x6 which is greater than or equal to in precision. | -| test.c:409:3:409:10 | ... >> ... | The operand x9 is shifted by an expression x9 which is greater than or equal to in precision. | -| test.c:412:3:412:11 | ... >> ... | The operand x9 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:413:3:413:11 | ... >> ... | The operand x9 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:414:3:414:11 | ... >> ... | The operand x9 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:421:3:421:11 | ... >> ... | The operand x10 is shifted by an expression x6 which is greater than or equal to in precision. | -| test.c:422:3:422:11 | ... >> ... | The operand x10 is shifted by an expression x7 which is greater than or equal to in precision. | -| test.c:423:3:423:11 | ... >> ... | The operand x10 is shifted by an expression x8 which is greater than or equal to in precision. | -| test.c:424:3:424:11 | ... >> ... | The operand x10 is shifted by an expression x9 which is greater than or equal to in precision. | -| test.c:425:3:426:9 | ... >> ... | The operand x10 is shifted by an expression x10 which is greater than or equal to in precision. | -| test.c:427:3:428:9 | ... >> ... | The operand x10 is shifted by an expression x11 which is greater than or equal to in precision. | -| test.c:429:3:430:9 | ... >> ... | The operand x10 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:431:3:432:9 | ... >> ... | The operand x10 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:433:3:434:9 | ... >> ... | The operand x10 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:441:3:441:11 | ... >> ... | The operand x11 is shifted by an expression x6 which is greater than or equal to in precision. | -| test.c:442:3:442:11 | ... >> ... | The operand x11 is shifted by an expression x7 which is greater than or equal to in precision. | -| test.c:443:3:443:11 | ... >> ... | The operand x11 is shifted by an expression x8 which is greater than or equal to in precision. | -| test.c:444:3:444:11 | ... >> ... | The operand x11 is shifted by an expression x9 which is greater than or equal to in precision. | -| test.c:445:3:446:9 | ... >> ... | The operand x11 is shifted by an expression x10 which is greater than or equal to in precision. | -| test.c:447:3:448:9 | ... >> ... | The operand x11 is shifted by an expression x11 which is greater than or equal to in precision. | -| test.c:449:3:450:9 | ... >> ... | The operand x11 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:451:3:452:9 | ... >> ... | The operand x11 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:453:3:454:9 | ... >> ... | The operand x11 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:467:3:468:9 | ... >> ... | The operand x12 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:483:3:484:9 | ... >> ... | The operand x13 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:485:3:486:9 | ... >> ... | The operand x13 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:487:3:488:9 | ... >> ... | The operand x13 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:501:3:502:9 | ... >> ... | The operand x14 is shifted by an expression x12 which is greater than or equal to in precision. | -| test.c:503:3:504:9 | ... >> ... | The operand x14 is shifted by an expression x13 which is greater than or equal to in precision. | -| test.c:505:3:506:9 | ... >> ... | The operand x14 is shifted by an expression x14 which is greater than or equal to in precision. | -| test.c:510:3:510:10 | ... << ... | The operand x0 is shifted by a negative expression -1. | -| test.c:511:3:511:10 | ... << ... | The operand x1 is shifted by a negative expression -1. | -| test.c:512:3:512:10 | ... << ... | The operand x2 is shifted by a negative expression -1. | -| test.c:513:3:513:10 | ... << ... | The operand x3 is shifted by a negative expression -1. | -| test.c:514:3:514:10 | ... << ... | The operand x4 is shifted by a negative expression -1. | -| test.c:515:3:515:10 | ... << ... | The operand x5 is shifted by a negative expression -1. | -| test.c:516:3:516:10 | ... << ... | The operand x6 is shifted by a negative expression -1. | -| test.c:517:3:517:10 | ... << ... | The operand x7 is shifted by a negative expression -1. | -| test.c:518:3:518:10 | ... << ... | The operand x8 is shifted by a negative expression -1. | -| test.c:519:3:519:10 | ... << ... | The operand x9 is shifted by a negative expression -1. | -| test.c:520:3:520:11 | ... << ... | The operand x10 is shifted by a negative expression -1. | -| test.c:521:3:521:11 | ... << ... | The operand x11 is shifted by a negative expression -1. | -| test.c:522:3:522:11 | ... << ... | The operand x12 is shifted by a negative expression -1. | -| test.c:523:3:523:11 | ... << ... | The operand x13 is shifted by a negative expression -1. | -| test.c:524:3:524:11 | ... << ... | The operand x14 is shifted by a negative expression -1. | +| test.c:43:3:43:14 | left-shift | The operand lhs0 is left-shifted by an expression rhs0 which is greater than or equal to in precision. | +| test.c:47:3:47:14 | left-shift | The operand lhs0 is left-shifted by an expression rhs3 which is greater than or equal to in precision. | +| test.c:49:3:49:14 | left-shift | The operand lhs0 is left-shifted by an expression rhs4 which is greater than or equal to in precision. | +| test.c:51:3:51:14 | left-shift | The operand lhs0 is left-shifted by an expression rhs5 which is greater than or equal to in precision. | +| test.c:53:3:53:14 | left-shift | The operand lhs0 is left-shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:55:3:55:14 | left-shift | The operand lhs0 is left-shifted by an expression rhs7 which is greater than or equal to in precision. | +| test.c:57:3:57:14 | left-shift | The operand lhs0 is left-shifted by an expression rhs8 which is greater than or equal to in precision. | +| test.c:59:3:59:14 | left-shift | The operand lhs0 is left-shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:61:3:61:15 | left-shift | The operand lhs0 is left-shifted by an expression rhs10 which is greater than or equal to in precision. | +| test.c:63:3:63:15 | left-shift | The operand lhs0 is left-shifted by an expression rhs11 which is greater than or equal to in precision. | +| test.c:65:3:65:15 | left-shift | The operand lhs0 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:67:3:67:15 | left-shift | The operand lhs0 is left-shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:69:3:69:15 | left-shift | The operand lhs0 is left-shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:71:3:71:14 | left-shift | The operand lhs1 is left-shifted by an expression rhs0 which is greater than or equal to in precision. | +| test.c:73:3:73:14 | left-shift | The operand lhs1 is left-shifted by an expression rhs1 which is greater than or equal to in precision. | +| test.c:75:3:75:14 | left-shift | The operand lhs1 is left-shifted by an expression rhs2 which is greater than or equal to in precision. | +| test.c:77:3:77:14 | left-shift | The operand lhs1 is left-shifted by an expression rhs3 which is greater than or equal to in precision. | +| test.c:79:3:79:14 | left-shift | The operand lhs1 is left-shifted by an expression rhs4 which is greater than or equal to in precision. | +| test.c:81:3:81:14 | left-shift | The operand lhs1 is left-shifted by an expression rhs5 which is greater than or equal to in precision. | +| test.c:83:3:83:14 | left-shift | The operand lhs1 is left-shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:85:3:85:14 | left-shift | The operand lhs1 is left-shifted by an expression rhs7 which is greater than or equal to in precision. | +| test.c:87:3:87:14 | left-shift | The operand lhs1 is left-shifted by an expression rhs8 which is greater than or equal to in precision. | +| test.c:89:3:89:14 | left-shift | The operand lhs1 is left-shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:91:3:91:15 | left-shift | The operand lhs1 is left-shifted by an expression rhs10 which is greater than or equal to in precision. | +| test.c:93:3:93:15 | left-shift | The operand lhs1 is left-shifted by an expression rhs11 which is greater than or equal to in precision. | +| test.c:95:3:95:15 | left-shift | The operand lhs1 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:97:3:97:15 | left-shift | The operand lhs1 is left-shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:99:3:99:15 | left-shift | The operand lhs1 is left-shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:101:3:101:14 | left-shift | The operand lhs2 is left-shifted by an expression rhs0 which is greater than or equal to in precision. | +| test.c:103:3:103:14 | left-shift | The operand lhs2 is left-shifted by an expression rhs1 which is greater than or equal to in precision. | +| test.c:105:3:105:14 | left-shift | The operand lhs2 is left-shifted by an expression rhs2 which is greater than or equal to in precision. | +| test.c:107:3:107:14 | left-shift | The operand lhs2 is left-shifted by an expression rhs3 which is greater than or equal to in precision. | +| test.c:109:3:109:14 | left-shift | The operand lhs2 is left-shifted by an expression rhs4 which is greater than or equal to in precision. | +| test.c:111:3:111:14 | left-shift | The operand lhs2 is left-shifted by an expression rhs5 which is greater than or equal to in precision. | +| test.c:113:3:113:14 | left-shift | The operand lhs2 is left-shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:115:3:115:14 | left-shift | The operand lhs2 is left-shifted by an expression rhs7 which is greater than or equal to in precision. | +| test.c:117:3:117:14 | left-shift | The operand lhs2 is left-shifted by an expression rhs8 which is greater than or equal to in precision. | +| test.c:119:3:119:14 | left-shift | The operand lhs2 is left-shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:121:3:121:15 | left-shift | The operand lhs2 is left-shifted by an expression rhs10 which is greater than or equal to in precision. | +| test.c:123:3:123:15 | left-shift | The operand lhs2 is left-shifted by an expression rhs11 which is greater than or equal to in precision. | +| test.c:125:3:125:15 | left-shift | The operand lhs2 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:127:3:127:15 | left-shift | The operand lhs2 is left-shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:129:3:129:15 | left-shift | The operand lhs2 is left-shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:134:3:134:14 | left-shift | The operand lhs3 is left-shifted by an expression rhs3 which is greater than or equal to in precision. | +| test.c:138:3:138:14 | left-shift | The operand lhs3 is left-shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:140:3:140:14 | left-shift | The operand lhs3 is left-shifted by an expression rhs7 which is greater than or equal to in precision. | +| test.c:142:3:142:14 | left-shift | The operand lhs3 is left-shifted by an expression rhs8 which is greater than or equal to in precision. | +| test.c:144:3:144:14 | left-shift | The operand lhs3 is left-shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:146:3:146:15 | left-shift | The operand lhs3 is left-shifted by an expression rhs10 which is greater than or equal to in precision. | +| test.c:148:3:148:15 | left-shift | The operand lhs3 is left-shifted by an expression rhs11 which is greater than or equal to in precision. | +| test.c:150:3:150:15 | left-shift | The operand lhs3 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:152:3:152:15 | left-shift | The operand lhs3 is left-shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:154:3:154:15 | left-shift | The operand lhs3 is left-shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:159:3:159:14 | left-shift | The operand lhs4 is left-shifted by an expression rhs3 which is greater than or equal to in precision. | +| test.c:161:3:161:14 | left-shift | The operand lhs4 is left-shifted by an expression rhs4 which is greater than or equal to in precision. | +| test.c:163:3:163:14 | left-shift | The operand lhs4 is left-shifted by an expression rhs5 which is greater than or equal to in precision. | +| test.c:165:3:165:14 | left-shift | The operand lhs4 is left-shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:167:3:167:14 | left-shift | The operand lhs4 is left-shifted by an expression rhs7 which is greater than or equal to in precision. | +| test.c:169:3:169:14 | left-shift | The operand lhs4 is left-shifted by an expression rhs8 which is greater than or equal to in precision. | +| test.c:171:3:171:14 | left-shift | The operand lhs4 is left-shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:173:3:173:15 | left-shift | The operand lhs4 is left-shifted by an expression rhs10 which is greater than or equal to in precision. | +| test.c:175:3:175:15 | left-shift | The operand lhs4 is left-shifted by an expression rhs11 which is greater than or equal to in precision. | +| test.c:177:3:177:15 | left-shift | The operand lhs4 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:179:3:179:15 | left-shift | The operand lhs4 is left-shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:181:3:181:15 | left-shift | The operand lhs4 is left-shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:186:3:186:14 | left-shift | The operand lhs5 is left-shifted by an expression rhs3 which is greater than or equal to in precision. | +| test.c:188:3:188:14 | left-shift | The operand lhs5 is left-shifted by an expression rhs4 which is greater than or equal to in precision. | +| test.c:190:3:190:14 | left-shift | The operand lhs5 is left-shifted by an expression rhs5 which is greater than or equal to in precision. | +| test.c:192:3:192:14 | left-shift | The operand lhs5 is left-shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:194:3:194:14 | left-shift | The operand lhs5 is left-shifted by an expression rhs7 which is greater than or equal to in precision. | +| test.c:196:3:196:14 | left-shift | The operand lhs5 is left-shifted by an expression rhs8 which is greater than or equal to in precision. | +| test.c:198:3:198:14 | left-shift | The operand lhs5 is left-shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:200:3:200:15 | left-shift | The operand lhs5 is left-shifted by an expression rhs10 which is greater than or equal to in precision. | +| test.c:202:3:202:15 | left-shift | The operand lhs5 is left-shifted by an expression rhs11 which is greater than or equal to in precision. | +| test.c:204:3:204:15 | left-shift | The operand lhs5 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:206:3:206:15 | left-shift | The operand lhs5 is left-shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:208:3:208:15 | left-shift | The operand lhs5 is left-shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:216:3:216:14 | left-shift | The operand lhs6 is left-shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:220:3:220:14 | left-shift | The operand lhs6 is left-shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:224:3:224:15 | left-shift | The operand lhs6 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:226:3:226:15 | left-shift | The operand lhs6 is left-shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:228:3:228:15 | left-shift | The operand lhs6 is left-shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:236:3:236:14 | left-shift | The operand lhs7 is left-shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:238:3:238:14 | left-shift | The operand lhs7 is left-shifted by an expression rhs7 which is greater than or equal to in precision. | +| test.c:240:3:240:14 | left-shift | The operand lhs7 is left-shifted by an expression rhs8 which is greater than or equal to in precision. | +| test.c:242:3:242:14 | left-shift | The operand lhs7 is left-shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:244:3:244:15 | left-shift | The operand lhs7 is left-shifted by an expression rhs10 which is greater than or equal to in precision. | +| test.c:246:3:246:15 | left-shift | The operand lhs7 is left-shifted by an expression rhs11 which is greater than or equal to in precision. | +| test.c:248:3:248:15 | left-shift | The operand lhs7 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:250:3:250:15 | left-shift | The operand lhs7 is left-shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:252:3:252:15 | left-shift | The operand lhs7 is left-shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:260:3:260:14 | left-shift | The operand lhs8 is left-shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:262:3:262:14 | left-shift | The operand lhs8 is left-shifted by an expression rhs7 which is greater than or equal to in precision. | +| test.c:264:3:264:14 | left-shift | The operand lhs8 is left-shifted by an expression rhs8 which is greater than or equal to in precision. | +| test.c:266:3:266:14 | left-shift | The operand lhs8 is left-shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:268:3:268:15 | left-shift | The operand lhs8 is left-shifted by an expression rhs10 which is greater than or equal to in precision. | +| test.c:270:3:270:15 | left-shift | The operand lhs8 is left-shifted by an expression rhs11 which is greater than or equal to in precision. | +| test.c:272:3:272:15 | left-shift | The operand lhs8 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:274:3:274:15 | left-shift | The operand lhs8 is left-shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:276:3:276:15 | left-shift | The operand lhs8 is left-shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:292:3:292:15 | left-shift | The operand lhs9 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:316:3:316:16 | left-shift | The operand lhs10 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:318:3:318:16 | left-shift | The operand lhs10 is left-shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:320:3:320:16 | left-shift | The operand lhs10 is left-shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:340:3:340:16 | left-shift | The operand lhs11 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:342:3:342:16 | left-shift | The operand lhs11 is left-shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:344:3:344:16 | left-shift | The operand lhs11 is left-shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:358:3:358:16 | left-shift | The operand lhs12 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:374:3:374:16 | left-shift | The operand lhs13 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:376:3:376:16 | left-shift | The operand lhs13 is left-shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:378:3:378:16 | left-shift | The operand lhs13 is left-shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:392:3:392:16 | left-shift | The operand lhs14 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:394:3:394:16 | left-shift | The operand lhs14 is left-shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:396:3:396:16 | left-shift | The operand lhs14 is left-shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:1579:3:1580:10 | right-shift | The operand lhs0 is right-shifted by an expression rhs0 which is greater than or equal to in precision. | +| test.c:1583:3:1584:10 | right-shift | The operand lhs0 is right-shifted by an expression rhs3 which is greater than or equal to in precision. | +| test.c:1585:3:1586:10 | right-shift | The operand lhs0 is right-shifted by an expression rhs4 which is greater than or equal to in precision. | +| test.c:1587:3:1588:10 | right-shift | The operand lhs0 is right-shifted by an expression rhs5 which is greater than or equal to in precision. | +| test.c:1589:3:1590:10 | right-shift | The operand lhs0 is right-shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:1591:3:1592:10 | right-shift | The operand lhs0 is right-shifted by an expression rhs7 which is greater than or equal to in precision. | +| test.c:1593:3:1594:10 | right-shift | The operand lhs0 is right-shifted by an expression rhs8 which is greater than or equal to in precision. | +| test.c:1595:3:1596:10 | right-shift | The operand lhs0 is right-shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:1597:3:1597:15 | right-shift | The operand lhs0 is right-shifted by an expression rhs10 which is greater than or equal to in precision. | +| test.c:1599:3:1599:15 | right-shift | The operand lhs0 is right-shifted by an expression rhs11 which is greater than or equal to in precision. | +| test.c:1601:3:1601:15 | right-shift | The operand lhs0 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:1603:3:1603:15 | right-shift | The operand lhs0 is right-shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:1605:3:1605:15 | right-shift | The operand lhs0 is right-shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:1607:3:1608:10 | right-shift | The operand lhs1 is right-shifted by an expression rhs0 which is greater than or equal to in precision. | +| test.c:1609:3:1610:10 | right-shift | The operand lhs1 is right-shifted by an expression rhs1 which is greater than or equal to in precision. | +| test.c:1611:3:1612:10 | right-shift | The operand lhs1 is right-shifted by an expression rhs2 which is greater than or equal to in precision. | +| test.c:1613:3:1614:10 | right-shift | The operand lhs1 is right-shifted by an expression rhs3 which is greater than or equal to in precision. | +| test.c:1615:3:1616:10 | right-shift | The operand lhs1 is right-shifted by an expression rhs4 which is greater than or equal to in precision. | +| test.c:1617:3:1618:10 | right-shift | The operand lhs1 is right-shifted by an expression rhs5 which is greater than or equal to in precision. | +| test.c:1619:3:1620:10 | right-shift | The operand lhs1 is right-shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:1621:3:1622:10 | right-shift | The operand lhs1 is right-shifted by an expression rhs7 which is greater than or equal to in precision. | +| test.c:1623:3:1624:10 | right-shift | The operand lhs1 is right-shifted by an expression rhs8 which is greater than or equal to in precision. | +| test.c:1625:3:1626:10 | right-shift | The operand lhs1 is right-shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:1627:3:1627:15 | right-shift | The operand lhs1 is right-shifted by an expression rhs10 which is greater than or equal to in precision. | +| test.c:1629:3:1629:15 | right-shift | The operand lhs1 is right-shifted by an expression rhs11 which is greater than or equal to in precision. | +| test.c:1631:3:1631:15 | right-shift | The operand lhs1 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:1633:3:1633:15 | right-shift | The operand lhs1 is right-shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:1635:3:1635:15 | right-shift | The operand lhs1 is right-shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:1637:3:1638:10 | right-shift | The operand lhs2 is right-shifted by an expression rhs0 which is greater than or equal to in precision. | +| test.c:1639:3:1640:10 | right-shift | The operand lhs2 is right-shifted by an expression rhs1 which is greater than or equal to in precision. | +| test.c:1641:3:1642:10 | right-shift | The operand lhs2 is right-shifted by an expression rhs2 which is greater than or equal to in precision. | +| test.c:1643:3:1644:10 | right-shift | The operand lhs2 is right-shifted by an expression rhs3 which is greater than or equal to in precision. | +| test.c:1645:3:1646:10 | right-shift | The operand lhs2 is right-shifted by an expression rhs4 which is greater than or equal to in precision. | +| test.c:1647:3:1648:10 | right-shift | The operand lhs2 is right-shifted by an expression rhs5 which is greater than or equal to in precision. | +| test.c:1649:3:1650:10 | right-shift | The operand lhs2 is right-shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:1651:3:1652:10 | right-shift | The operand lhs2 is right-shifted by an expression rhs7 which is greater than or equal to in precision. | +| test.c:1653:3:1654:10 | right-shift | The operand lhs2 is right-shifted by an expression rhs8 which is greater than or equal to in precision. | +| test.c:1655:3:1656:10 | right-shift | The operand lhs2 is right-shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:1657:3:1657:15 | right-shift | The operand lhs2 is right-shifted by an expression rhs10 which is greater than or equal to in precision. | +| test.c:1659:3:1659:15 | right-shift | The operand lhs2 is right-shifted by an expression rhs11 which is greater than or equal to in precision. | +| test.c:1661:3:1661:15 | right-shift | The operand lhs2 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:1663:3:1663:15 | right-shift | The operand lhs2 is right-shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:1665:3:1665:15 | right-shift | The operand lhs2 is right-shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:1670:3:1671:10 | right-shift | The operand lhs3 is right-shifted by an expression rhs3 which is greater than or equal to in precision. | +| test.c:1674:3:1675:10 | right-shift | The operand lhs3 is right-shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:1676:3:1677:10 | right-shift | The operand lhs3 is right-shifted by an expression rhs7 which is greater than or equal to in precision. | +| test.c:1678:3:1679:10 | right-shift | The operand lhs3 is right-shifted by an expression rhs8 which is greater than or equal to in precision. | +| test.c:1680:3:1681:10 | right-shift | The operand lhs3 is right-shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:1682:3:1682:15 | right-shift | The operand lhs3 is right-shifted by an expression rhs10 which is greater than or equal to in precision. | +| test.c:1684:3:1684:15 | right-shift | The operand lhs3 is right-shifted by an expression rhs11 which is greater than or equal to in precision. | +| test.c:1686:3:1686:15 | right-shift | The operand lhs3 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:1688:3:1688:15 | right-shift | The operand lhs3 is right-shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:1690:3:1690:15 | right-shift | The operand lhs3 is right-shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:1695:3:1696:10 | right-shift | The operand lhs4 is right-shifted by an expression rhs3 which is greater than or equal to in precision. | +| test.c:1697:3:1698:10 | right-shift | The operand lhs4 is right-shifted by an expression rhs4 which is greater than or equal to in precision. | +| test.c:1699:3:1700:10 | right-shift | The operand lhs4 is right-shifted by an expression rhs5 which is greater than or equal to in precision. | +| test.c:1701:3:1702:10 | right-shift | The operand lhs4 is right-shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:1703:3:1704:10 | right-shift | The operand lhs4 is right-shifted by an expression rhs7 which is greater than or equal to in precision. | +| test.c:1705:3:1706:10 | right-shift | The operand lhs4 is right-shifted by an expression rhs8 which is greater than or equal to in precision. | +| test.c:1707:3:1708:10 | right-shift | The operand lhs4 is right-shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:1709:3:1709:15 | right-shift | The operand lhs4 is right-shifted by an expression rhs10 which is greater than or equal to in precision. | +| test.c:1711:3:1711:15 | right-shift | The operand lhs4 is right-shifted by an expression rhs11 which is greater than or equal to in precision. | +| test.c:1713:3:1713:15 | right-shift | The operand lhs4 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:1715:3:1715:15 | right-shift | The operand lhs4 is right-shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:1717:3:1717:15 | right-shift | The operand lhs4 is right-shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:1722:3:1723:10 | right-shift | The operand lhs5 is right-shifted by an expression rhs3 which is greater than or equal to in precision. | +| test.c:1724:3:1725:10 | right-shift | The operand lhs5 is right-shifted by an expression rhs4 which is greater than or equal to in precision. | +| test.c:1726:3:1727:10 | right-shift | The operand lhs5 is right-shifted by an expression rhs5 which is greater than or equal to in precision. | +| test.c:1728:3:1729:10 | right-shift | The operand lhs5 is right-shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:1730:3:1731:10 | right-shift | The operand lhs5 is right-shifted by an expression rhs7 which is greater than or equal to in precision. | +| test.c:1732:3:1733:10 | right-shift | The operand lhs5 is right-shifted by an expression rhs8 which is greater than or equal to in precision. | +| test.c:1734:3:1735:10 | right-shift | The operand lhs5 is right-shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:1736:3:1736:15 | right-shift | The operand lhs5 is right-shifted by an expression rhs10 which is greater than or equal to in precision. | +| test.c:1738:3:1738:15 | right-shift | The operand lhs5 is right-shifted by an expression rhs11 which is greater than or equal to in precision. | +| test.c:1740:3:1740:15 | right-shift | The operand lhs5 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:1742:3:1742:15 | right-shift | The operand lhs5 is right-shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:1744:3:1744:15 | right-shift | The operand lhs5 is right-shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:1752:3:1753:10 | right-shift | The operand lhs6 is right-shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:1756:3:1757:10 | right-shift | The operand lhs6 is right-shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:1760:3:1760:15 | right-shift | The operand lhs6 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:1762:3:1762:15 | right-shift | The operand lhs6 is right-shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:1764:3:1764:15 | right-shift | The operand lhs6 is right-shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:1772:3:1773:10 | right-shift | The operand lhs7 is right-shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:1774:3:1775:10 | right-shift | The operand lhs7 is right-shifted by an expression rhs7 which is greater than or equal to in precision. | +| test.c:1776:3:1777:10 | right-shift | The operand lhs7 is right-shifted by an expression rhs8 which is greater than or equal to in precision. | +| test.c:1778:3:1779:10 | right-shift | The operand lhs7 is right-shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:1780:3:1780:15 | right-shift | The operand lhs7 is right-shifted by an expression rhs10 which is greater than or equal to in precision. | +| test.c:1782:3:1782:15 | right-shift | The operand lhs7 is right-shifted by an expression rhs11 which is greater than or equal to in precision. | +| test.c:1784:3:1784:15 | right-shift | The operand lhs7 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:1786:3:1786:15 | right-shift | The operand lhs7 is right-shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:1788:3:1788:15 | right-shift | The operand lhs7 is right-shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:1796:3:1797:10 | right-shift | The operand lhs8 is right-shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:1798:3:1799:10 | right-shift | The operand lhs8 is right-shifted by an expression rhs7 which is greater than or equal to in precision. | +| test.c:1800:3:1801:10 | right-shift | The operand lhs8 is right-shifted by an expression rhs8 which is greater than or equal to in precision. | +| test.c:1802:3:1803:10 | right-shift | The operand lhs8 is right-shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:1804:3:1804:15 | right-shift | The operand lhs8 is right-shifted by an expression rhs10 which is greater than or equal to in precision. | +| test.c:1806:3:1806:15 | right-shift | The operand lhs8 is right-shifted by an expression rhs11 which is greater than or equal to in precision. | +| test.c:1808:3:1808:15 | right-shift | The operand lhs8 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:1810:3:1810:15 | right-shift | The operand lhs8 is right-shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:1812:3:1812:15 | right-shift | The operand lhs8 is right-shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:1828:3:1828:15 | right-shift | The operand lhs9 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:1852:3:1852:16 | right-shift | The operand lhs10 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:1854:3:1854:16 | right-shift | The operand lhs10 is right-shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:1856:3:1856:16 | right-shift | The operand lhs10 is right-shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:1876:3:1876:16 | right-shift | The operand lhs11 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:1878:3:1878:16 | right-shift | The operand lhs11 is right-shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:1880:3:1880:16 | right-shift | The operand lhs11 is right-shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:1894:3:1894:16 | right-shift | The operand lhs12 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:1910:3:1910:16 | right-shift | The operand lhs13 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:1912:3:1912:16 | right-shift | The operand lhs13 is right-shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:1914:3:1914:16 | right-shift | The operand lhs13 is right-shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:1928:3:1928:16 | right-shift | The operand lhs14 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:1930:3:1930:16 | right-shift | The operand lhs14 is right-shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:1932:3:1932:16 | right-shift | The operand lhs14 is right-shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:3115:3:3115:12 | left-shift | The operand lhs0 is left-shifted by a negative expression - .... | +| test.c:3116:3:3116:12 | left-shift | The operand lhs1 is left-shifted by a negative expression - .... | +| test.c:3117:3:3117:12 | left-shift | The operand lhs2 is left-shifted by a negative expression - .... | +| test.c:3118:3:3118:12 | left-shift | The operand lhs3 is left-shifted by a negative expression - .... | +| test.c:3119:3:3119:12 | left-shift | The operand lhs4 is left-shifted by a negative expression - .... | +| test.c:3120:3:3120:12 | left-shift | The operand lhs5 is left-shifted by a negative expression - .... | +| test.c:3121:3:3121:12 | left-shift | The operand lhs6 is left-shifted by a negative expression - .... | +| test.c:3122:3:3122:12 | left-shift | The operand lhs7 is left-shifted by a negative expression - .... | +| test.c:3123:3:3123:12 | left-shift | The operand lhs8 is left-shifted by a negative expression - .... | +| test.c:3124:3:3124:12 | left-shift | The operand lhs9 is left-shifted by a negative expression - .... | +| test.c:3125:3:3125:13 | left-shift | The operand lhs10 is left-shifted by a negative expression - .... | +| test.c:3126:3:3126:13 | left-shift | The operand lhs11 is left-shifted by a negative expression - .... | +| test.c:3127:3:3127:13 | left-shift | The operand lhs12 is left-shifted by a negative expression - .... | +| test.c:3128:3:3128:13 | left-shift | The operand lhs13 is left-shifted by a negative expression - .... | +| test.c:3129:3:3129:13 | left-shift | The operand lhs14 is left-shifted by a negative expression - .... | \ No newline at end of file From 37d59bb3eeb0930e0b259fb55b7c296bccc22087 Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Mon, 27 Mar 2023 14:10:44 -0700 Subject: [PATCH 46/53] Update DIR-4-6 to include size check for typedef --- ...ainNumericalTypeUsedOverExplicitTypedef.ql | 21 +++++-- ...ericalTypeUsedOverExplicitTypedef.expected | 2 + c/misra/test/rules/DIR-4-6/test.c | 62 +++++++++---------- 3 files changed, 50 insertions(+), 35 deletions(-) diff --git a/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql b/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql index 16d8af6595..6c8d283786 100644 --- a/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql +++ b/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql @@ -37,10 +37,23 @@ predicate forbiddenBuiltinNumericUsedInDecl(Variable var, string message) { message = "The type " + var.getType() + " is not a fixed-width numeric type." } -predicate forbiddenTypedef(TypedefType typedef, string message) { - typedef.getBaseType() instanceof BuiltInNumericType and - not typedef.getName().regexpMatch("u?(int|float)(4|8|16|32|64|128)_t") and - message = "The type " + typedef.getName() + " is not an alias to a fixed-width numeric type." +// TODO: add some inline comments +predicate forbiddenTypedef(CTypedefType typedef, string message) { + /* If the typedef's name contains an explicit size */ + ( + if typedef.getName().regexpMatch("u?(int|float)(4|8|16|32|64|128)_t") + then ( + /* Then the actual type size should match. */ + not typedef.getSize() * 8 = + // times 8 because getSize() gets the size in bytes + typedef.getName().regexpCapture("u?(int|float)(4|8|16|32|64|128)_t", 2).toInt() and + message = "The typedef type " + typedef.getName() + " does not have its indicated size." + ) else ( + /* Otherwise, the aliased type itself should have an explicit size in its name. */ + not typedef.getBaseType().getName().regexpMatch("u?(int|float)(4|8|16|32|64|128)_t") and + message = "The type " + typedef.getName() + " is not an alias to a fixed-width numeric type." + ) + ) } from Element elem, string message diff --git a/c/misra/test/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.expected b/c/misra/test/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.expected index 49865c8824..c7f1cba77a 100644 --- a/c/misra/test/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.expected +++ b/c/misra/test/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.expected @@ -1,3 +1,5 @@ +| test.c:14:5:14:10 | int4_t | The typedef type int4_t does not have its indicated size. | +| test.c:16:5:16:11 | uint4_t | The typedef type uint4_t does not have its indicated size. | | test.c:27:5:27:26 | _astronomical_number_t | The type _astronomical_number_t is not an alias to a fixed-width numeric type. | | test.c:34:15:34:16 | c2 | The type signed char is not a fixed-width numeric type. | | test.c:35:17:35:18 | c3 | The type unsigned char is not a fixed-width numeric type. | diff --git a/c/misra/test/rules/DIR-4-6/test.c b/c/misra/test/rules/DIR-4-6/test.c index b806b91c08..07b3c48901 100644 --- a/c/misra/test/rules/DIR-4-6/test.c +++ b/c/misra/test/rules/DIR-4-6/test.c @@ -1,19 +1,19 @@ -typedef signed char int8_t; // COMPLIANT: exception, typedefs are permitted -typedef unsigned char uint8_t; // COMPLIANT: exception, typedefs are permitted +typedef signed char int8_t; // COMPLIANT: exception, typedefs are permitted +typedef unsigned char uint8_t; // COMPLIANT: exception, typedefs are permitted typedef signed short int16_t; // COMPLIANT: exception, typedefs are permitted typedef unsigned short uint16_t; // COMPLIANT: exception, typedefs are permitted -typedef signed int int32_t; // COMPLIANT: exception, typedefs are permitted -typedef unsigned int uint32_t; // COMPLIANT: exception, typedefs are permitted +typedef signed int int32_t; // COMPLIANT: exception, typedefs are permitted +typedef unsigned int uint32_t; // COMPLIANT: exception, typedefs are permitted -typedef signed long int64_t; // COMPLIANT: exception, typedefs are permitted -typedef unsigned long uint64_t; // COMPLIANT: exception, typedefs are permitted +typedef signed long int64_t; // COMPLIANT: exception, typedefs are permitted +typedef unsigned long uint64_t; // COMPLIANT: exception, typedefs are permitted typedef signed long long - int128_t; // COMPLIANT: exception, typedefs are permitted + int4_t; // NON_COMPLIANT: typedef does not have its indicated size typedef unsigned long long - uint128_t; // COMPLIANT: exception, typedefs are permitted + uint4_t; // NON_COMPLIANT: typedef does not have its indicated size typedef float float32_t; // COMPLIANT: exception, typedefs are permitted typedef double float64_t; // COMPLIANT: exception, typedefs are permitted @@ -28,38 +28,38 @@ typedef int int // COMPLIANT: exception, main's return type can be plain int main(int argc, // COMPLIANT: exception, argc's type can be plain int - char *argv[]) { // COMPLIANT: char is not a basic numeric type + char *argv[]) { // COMPLIANT: char is not a basic numeric type - char c1 = 1; // COMPLIANT: char is not a basic numeric type - signed char c2 = 1; // NON_COMPLIANT: use typedef int8_t - unsigned char c3 = 1; // NON_COMPLIANT: use typedef uint8_t - int8_t c4 = 1; // COMPLIANT: typedef used instead + char c1 = 1; // COMPLIANT: char is not a basic numeric type + signed char c2 = 1; // NON_COMPLIANT: use typedef int8_t + unsigned char c3 = 1; // NON_COMPLIANT: use typedef uint8_t + int8_t c4 = 1; // COMPLIANT: typedef used instead - short s1 = 1; // NON_COMPLIANT: short is a basic numeric type - signed short s2 = 1; // NON_COMPLIANT: use typedef int16_t - unsigned short s3 = 1; // NON_COMPLIANT: use typedef uint16_t - int16_t s4 = 1; // COMPLIANT: typedef used instead + short s1 = 1; // NON_COMPLIANT: short is a basic numeric type + signed short s2 = 1; // NON_COMPLIANT: use typedef int16_t + unsigned short s3 = 1; // NON_COMPLIANT: use typedef uint16_t + int16_t s4 = 1; // COMPLIANT: typedef used instead - int i1 = 1; // NON_COMPLIANT: int is a basic numeric type - signed int i2 = 1; // NON_COMPLIANT: use typedef int32_t - unsigned int i3 = 1; // NON_COMPLIANT: use typedef uint32_t - int32_t i4 = 1; // COMPLIANT: typedef used instead + int i1 = 1; // NON_COMPLIANT: int is a basic numeric type + signed int i2 = 1; // NON_COMPLIANT: use typedef int32_t + unsigned int i3 = 1; // NON_COMPLIANT: use typedef uint32_t + int32_t i4 = 1; // COMPLIANT: typedef used instead - long l1 = 1; // NON_COMPLIANT: int is a basic numeric type - signed long l2 = 1; // NON_COMPLIANT: use typedef int64_t - unsigned long l3 = 1; // NON_COMPLIANT: use typedef uint64_t - int64_t l4 = 1; // COMPLIANT: typedef used instead + long l1 = 1; // NON_COMPLIANT: int is a basic numeric type + signed long l2 = 1; // NON_COMPLIANT: use typedef int64_t + unsigned long l3 = 1; // NON_COMPLIANT: use typedef uint64_t + int64_t l4 = 1; // COMPLIANT: typedef used instead long long ll1 = 1; // NON_COMPLIANT: int is a basic numeric type - signed long long ll2 = 1; // NON_COMPLIANT: use typedef int128_t - unsigned long long ll3 = 1; // NON_COMPLIANT: use typedef uint128_t - int128_t ll4 = 1; // COMPLIANT: typedef used instead + signed long long ll2 = 1; // NON_COMPLIANT: use typedef int64_t + unsigned long long ll3 = 1; // NON_COMPLIANT: use typedef uint64_t + int64_t ll4 = 1; // COMPLIANT: typedef used instead float f1 = 1; // NON_COMPLIANT: float is a basic numeric type, use a typedef - float32_t f2 = 1; // COMPLIANT: typedef used instead + float32_t f2 = 1; // COMPLIANT: typedef used instead - double d1 = 1; // NON_COMPLIANT: int is a basic numeric type - float64_t d2 = 1; // COMPLIANT: typedef used instead + double d1 = 1; // NON_COMPLIANT: int is a basic numeric type + float64_t d2 = 1; // COMPLIANT: typedef used instead long double ld1 = 1; // NON_COMPLIANT: int is a basic numeric type float128_t ld2 = 1; // COMPLIANT: typedef used instead From 2889a5d92a993bf93f1380c242e2f2827c1b9996 Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Mon, 27 Mar 2023 14:19:51 -0700 Subject: [PATCH 47/53] Address inconsistency in rules.csv --- rules.csv | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rules.csv b/rules.csv index cb91734842..14dae79c26 100644 --- a/rules.csv +++ b/rules.csv @@ -552,9 +552,9 @@ c,CERT-C,INT30-C,Yes,Rule,,,Ensure that unsigned integer operations do not wrap, c,CERT-C,INT31-C,Yes,Rule,,,Ensure that integer conversions do not result in lost or misinterpreted data,A4-7-1,IntegerOverflow,Hard, c,CERT-C,INT32-C,Yes,Rule,,,Ensure that operations on signed integers do not result in overflow,A4-7-1,IntegerOverflow,Hard, c,CERT-C,INT33-C,Yes,Rule,,,Ensure that division and remainder operations do not result in divide-by-zero errors,,IntegerOverflow,Hard, -c,CERT-C,INT34-C,Yes,Rule,,,Do not shift an expression by a negative number of bits or by greater than or equal to the number of bits that exist in the operand,M5-8-1,Types,Import, +c,CERT-C,INT34-C,Yes,Rule,,,Do not shift an expression by a negative number of bits or by greater than or equal to the number of bits that exist in the operand,M5-8-1,Types1,Import, c,CERT-C,INT35-C,Yes,Rule,,,Use correct integer precisions,,IntegerOverflow,Hard, -c,CERT-C,INT36-C,Yes,Rule,,,Converting a pointer to integer or integer to pointer,M5-2-9,Types,Easy, +c,CERT-C,INT36-C,Yes,Rule,,,Converting a pointer to integer or integer to pointer,M5-2-9,Types1,Easy, c,CERT-C,MEM30-C,Yes,Rule,,,Do not access freed memory,MEM50-CPP,InvalidMemory1,Import, c,CERT-C,MEM31-C,Yes,Rule,,,Free dynamically allocated memory when no longer needed,,Memory2,Very Hard, c,CERT-C,MEM33-C,Yes,Rule,,,Allocate and copy structures containing a flexible array member dynamically,,Memory2,Very Hard, @@ -686,7 +686,7 @@ c,MISRA-C-2012,RULE-12-1,Yes,Advisory,,,The precedence of operators within expre c,MISRA-C-2012,RULE-12-2,Yes,Required,,,The right hand operand of a shift operator shall lie in the range zero to one less than the width in bits of the essential type of the left hand operand,,Contracts7,Medium, c,MISRA-C-2012,RULE-12-3,Yes,Advisory,,,The comma operator should not be used,M5-18-1,Banned,Import, c,MISRA-C-2012,RULE-12-4,Yes,Advisory,,,Evaluation of constant expressions should not lead to unsigned integer wrap-around,INT30-C,IntegerOverflow,Easy, -c,MISRA-C-2012,RULE-12-5,Yes,Mandatory,,,The sizeof operator shall not have an operand which is a function parameter declared as �array of type�,,Types,Medium, +c,MISRA-C-2012,RULE-12-5,Yes,Mandatory,,,The sizeof operator shall not have an operand which is a function parameter declared as �array of type�,,Types1,Medium, c,MISRA-C-2012,RULE-13-1,Yes,Required,,,Initializer lists shall not contain persistent side effects,,SideEffects1,Medium, c,MISRA-C-2012,RULE-13-2,Yes,Required,,,The value of an expression and its persistent side effects shall be the same under all permitted evaluation orders,PRE31-C,SideEffects,Medium, c,MISRA-C-2012,RULE-13-3,Yes,Advisory,,,A full expression containing an increment (++) or decrement (--) operator should have no other potential side effects other than that caused by the increment or decrement operator,,SideEffects2,Medium, From ea313085f45742f11bca5b8f9d0408e4e606d515 Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Mon, 27 Mar 2023 14:57:29 -0700 Subject: [PATCH 48/53] Format test.c for DIR-4-6 --- c/misra/test/rules/DIR-4-6/test.c | 54 +++++++++++++++---------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/c/misra/test/rules/DIR-4-6/test.c b/c/misra/test/rules/DIR-4-6/test.c index 07b3c48901..db0842c4f6 100644 --- a/c/misra/test/rules/DIR-4-6/test.c +++ b/c/misra/test/rules/DIR-4-6/test.c @@ -1,17 +1,17 @@ -typedef signed char int8_t; // COMPLIANT: exception, typedefs are permitted -typedef unsigned char uint8_t; // COMPLIANT: exception, typedefs are permitted +typedef signed char int8_t; // COMPLIANT: exception, typedefs are permitted +typedef unsigned char uint8_t; // COMPLIANT: exception, typedefs are permitted typedef signed short int16_t; // COMPLIANT: exception, typedefs are permitted typedef unsigned short uint16_t; // COMPLIANT: exception, typedefs are permitted -typedef signed int int32_t; // COMPLIANT: exception, typedefs are permitted -typedef unsigned int uint32_t; // COMPLIANT: exception, typedefs are permitted +typedef signed int int32_t; // COMPLIANT: exception, typedefs are permitted +typedef unsigned int uint32_t; // COMPLIANT: exception, typedefs are permitted -typedef signed long int64_t; // COMPLIANT: exception, typedefs are permitted -typedef unsigned long uint64_t; // COMPLIANT: exception, typedefs are permitted +typedef signed long int64_t; // COMPLIANT: exception, typedefs are permitted +typedef unsigned long uint64_t; // COMPLIANT: exception, typedefs are permitted typedef signed long long - int4_t; // NON_COMPLIANT: typedef does not have its indicated size + int4_t; // NON_COMPLIANT: typedef does not have its indicated size typedef unsigned long long uint4_t; // NON_COMPLIANT: typedef does not have its indicated size @@ -28,27 +28,27 @@ typedef int int // COMPLIANT: exception, main's return type can be plain int main(int argc, // COMPLIANT: exception, argc's type can be plain int - char *argv[]) { // COMPLIANT: char is not a basic numeric type + char *argv[]) { // COMPLIANT: char is not a basic numeric type - char c1 = 1; // COMPLIANT: char is not a basic numeric type - signed char c2 = 1; // NON_COMPLIANT: use typedef int8_t - unsigned char c3 = 1; // NON_COMPLIANT: use typedef uint8_t - int8_t c4 = 1; // COMPLIANT: typedef used instead + char c1 = 1; // COMPLIANT: char is not a basic numeric type + signed char c2 = 1; // NON_COMPLIANT: use typedef int8_t + unsigned char c3 = 1; // NON_COMPLIANT: use typedef uint8_t + int8_t c4 = 1; // COMPLIANT: typedef used instead - short s1 = 1; // NON_COMPLIANT: short is a basic numeric type - signed short s2 = 1; // NON_COMPLIANT: use typedef int16_t - unsigned short s3 = 1; // NON_COMPLIANT: use typedef uint16_t - int16_t s4 = 1; // COMPLIANT: typedef used instead + short s1 = 1; // NON_COMPLIANT: short is a basic numeric type + signed short s2 = 1; // NON_COMPLIANT: use typedef int16_t + unsigned short s3 = 1; // NON_COMPLIANT: use typedef uint16_t + int16_t s4 = 1; // COMPLIANT: typedef used instead - int i1 = 1; // NON_COMPLIANT: int is a basic numeric type - signed int i2 = 1; // NON_COMPLIANT: use typedef int32_t - unsigned int i3 = 1; // NON_COMPLIANT: use typedef uint32_t - int32_t i4 = 1; // COMPLIANT: typedef used instead + int i1 = 1; // NON_COMPLIANT: int is a basic numeric type + signed int i2 = 1; // NON_COMPLIANT: use typedef int32_t + unsigned int i3 = 1; // NON_COMPLIANT: use typedef uint32_t + int32_t i4 = 1; // COMPLIANT: typedef used instead - long l1 = 1; // NON_COMPLIANT: int is a basic numeric type - signed long l2 = 1; // NON_COMPLIANT: use typedef int64_t - unsigned long l3 = 1; // NON_COMPLIANT: use typedef uint64_t - int64_t l4 = 1; // COMPLIANT: typedef used instead + long l1 = 1; // NON_COMPLIANT: int is a basic numeric type + signed long l2 = 1; // NON_COMPLIANT: use typedef int64_t + unsigned long l3 = 1; // NON_COMPLIANT: use typedef uint64_t + int64_t l4 = 1; // COMPLIANT: typedef used instead long long ll1 = 1; // NON_COMPLIANT: int is a basic numeric type signed long long ll2 = 1; // NON_COMPLIANT: use typedef int64_t @@ -56,10 +56,10 @@ main(int argc, // COMPLIANT: exception, argc's type can be plain int int64_t ll4 = 1; // COMPLIANT: typedef used instead float f1 = 1; // NON_COMPLIANT: float is a basic numeric type, use a typedef - float32_t f2 = 1; // COMPLIANT: typedef used instead + float32_t f2 = 1; // COMPLIANT: typedef used instead - double d1 = 1; // NON_COMPLIANT: int is a basic numeric type - float64_t d2 = 1; // COMPLIANT: typedef used instead + double d1 = 1; // NON_COMPLIANT: int is a basic numeric type + float64_t d2 = 1; // COMPLIANT: typedef used instead long double ld1 = 1; // NON_COMPLIANT: int is a basic numeric type float128_t ld2 = 1; // COMPLIANT: typedef used instead From 207d908a852d17c60f1de9ebc55c092f269b4e44 Mon Sep 17 00:00:00 2001 From: Jeongsoo Lee Date: Tue, 28 Mar 2023 11:40:10 -0700 Subject: [PATCH 49/53] Tidy up overall --- ...ftedbyNegativeOrGreaterPrecisionOperand.ql | 40 +- ...tingAPointerToIntegerOrIntegerToPointer.ql | 4 - ...NegativeOrGreaterPrecisionOperand.expected | 402 +++++++----------- .../StringLiteralAssignedToNonConstChar.ql | 9 +- ...ringLiteralAssignedToNonConstChar.expected | 16 +- 5 files changed, 173 insertions(+), 298 deletions(-) diff --git a/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql b/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql index 1f73583cfb..c53e480aac 100644 --- a/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql +++ b/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql @@ -44,42 +44,12 @@ class BitShiftExpr extends BinaryBitwiseOperation { this instanceof LShiftExpr or this instanceof RShiftExpr } - - override string toString() { - if this instanceof LShiftExpr then result = "left-shift" else result = "right-shift" - } } -int getPrecision(BuiltInType type) { - type.(CharType).isExplicitlyUnsigned() and result = type.(CharType).getSize() * 8 - or - type.(ShortType).isExplicitlyUnsigned() and result = type.(ShortType).getSize() * 8 - or - type.(IntType).isExplicitlyUnsigned() and result = type.(IntType).getSize() * 8 - or - type.(LongType).isExplicitlyUnsigned() and result = type.(LongType).getSize() * 8 - or - type.(LongLongType).isExplicitlyUnsigned() and result = type.(LongLongType).getSize() * 8 - or - type instanceof CharType and - not type.(CharType).isExplicitlyUnsigned() and - result = type.(CharType).getSize() * 8 - 1 - or - type instanceof ShortType and - not type.(ShortType).isExplicitlyUnsigned() and - result = type.(ShortType).getSize() * 8 - 1 - or - type instanceof IntType and - not type.(IntType).isExplicitlyUnsigned() and - result = type.(IntType).getSize() * 8 - 1 - or - type instanceof LongType and - not type.(LongType).isExplicitlyUnsigned() and - result = type.(LongType).getSize() * 8 - 1 +int getPrecision(IntegralType type) { + type.isExplicitlyUnsigned() and result = type.getSize() * 8 or - type instanceof LongLongType and - not type.(LongLongType).isExplicitlyUnsigned() and - result = type.(LongLongType).getSize() * 8 - 1 + type.isExplicitlySigned() and result = type.getSize() * 8 - 1 } predicate isForbiddenShiftExpr(BitShiftExpr shift, string message) { @@ -88,12 +58,12 @@ predicate isForbiddenShiftExpr(BitShiftExpr shift, string message) { getPrecision(shift.getLeftOperand().getUnderlyingType()) <= upperBound(shift.getRightOperand()) and message = - "The operand " + shift.getLeftOperand() + " is " + shift + "ed by an expression " + + "The operand " + shift.getLeftOperand() + " is shifted by an expression " + shift.getRightOperand() + " which is greater than or equal to in precision." or lowerBound(shift.getRightOperand()) < 0 and message = - "The operand " + shift.getLeftOperand() + " is " + shift + "ed by a negative expression " + + "The operand " + shift.getLeftOperand() + " is shifted by a negative expression " + shift.getRightOperand() + "." ) and /* diff --git a/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql b/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql index 5d8d13b0ed..3052f0aadd 100644 --- a/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql +++ b/c/cert/src/rules/INT36-C/ConvertingAPointerToIntegerOrIntegerToPointer.ql @@ -30,10 +30,6 @@ class StdIntIntPtrType extends Type { this.getName().regexpMatch("u?intptr_t") ) } - - override string toString() { - if this.getName() = "uintptr_t" then result = "uintptr_t" else result = "intptr_t" - } } /** diff --git a/c/cert/test/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.expected b/c/cert/test/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.expected index 5ac7e8a05a..4d82ab7839 100644 --- a/c/cert/test/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.expected +++ b/c/cert/test/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.expected @@ -1,243 +1,159 @@ -| test.c:43:3:43:14 | left-shift | The operand lhs0 is left-shifted by an expression rhs0 which is greater than or equal to in precision. | -| test.c:47:3:47:14 | left-shift | The operand lhs0 is left-shifted by an expression rhs3 which is greater than or equal to in precision. | -| test.c:49:3:49:14 | left-shift | The operand lhs0 is left-shifted by an expression rhs4 which is greater than or equal to in precision. | -| test.c:51:3:51:14 | left-shift | The operand lhs0 is left-shifted by an expression rhs5 which is greater than or equal to in precision. | -| test.c:53:3:53:14 | left-shift | The operand lhs0 is left-shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:55:3:55:14 | left-shift | The operand lhs0 is left-shifted by an expression rhs7 which is greater than or equal to in precision. | -| test.c:57:3:57:14 | left-shift | The operand lhs0 is left-shifted by an expression rhs8 which is greater than or equal to in precision. | -| test.c:59:3:59:14 | left-shift | The operand lhs0 is left-shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:61:3:61:15 | left-shift | The operand lhs0 is left-shifted by an expression rhs10 which is greater than or equal to in precision. | -| test.c:63:3:63:15 | left-shift | The operand lhs0 is left-shifted by an expression rhs11 which is greater than or equal to in precision. | -| test.c:65:3:65:15 | left-shift | The operand lhs0 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:67:3:67:15 | left-shift | The operand lhs0 is left-shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:69:3:69:15 | left-shift | The operand lhs0 is left-shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:71:3:71:14 | left-shift | The operand lhs1 is left-shifted by an expression rhs0 which is greater than or equal to in precision. | -| test.c:73:3:73:14 | left-shift | The operand lhs1 is left-shifted by an expression rhs1 which is greater than or equal to in precision. | -| test.c:75:3:75:14 | left-shift | The operand lhs1 is left-shifted by an expression rhs2 which is greater than or equal to in precision. | -| test.c:77:3:77:14 | left-shift | The operand lhs1 is left-shifted by an expression rhs3 which is greater than or equal to in precision. | -| test.c:79:3:79:14 | left-shift | The operand lhs1 is left-shifted by an expression rhs4 which is greater than or equal to in precision. | -| test.c:81:3:81:14 | left-shift | The operand lhs1 is left-shifted by an expression rhs5 which is greater than or equal to in precision. | -| test.c:83:3:83:14 | left-shift | The operand lhs1 is left-shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:85:3:85:14 | left-shift | The operand lhs1 is left-shifted by an expression rhs7 which is greater than or equal to in precision. | -| test.c:87:3:87:14 | left-shift | The operand lhs1 is left-shifted by an expression rhs8 which is greater than or equal to in precision. | -| test.c:89:3:89:14 | left-shift | The operand lhs1 is left-shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:91:3:91:15 | left-shift | The operand lhs1 is left-shifted by an expression rhs10 which is greater than or equal to in precision. | -| test.c:93:3:93:15 | left-shift | The operand lhs1 is left-shifted by an expression rhs11 which is greater than or equal to in precision. | -| test.c:95:3:95:15 | left-shift | The operand lhs1 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:97:3:97:15 | left-shift | The operand lhs1 is left-shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:99:3:99:15 | left-shift | The operand lhs1 is left-shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:101:3:101:14 | left-shift | The operand lhs2 is left-shifted by an expression rhs0 which is greater than or equal to in precision. | -| test.c:103:3:103:14 | left-shift | The operand lhs2 is left-shifted by an expression rhs1 which is greater than or equal to in precision. | -| test.c:105:3:105:14 | left-shift | The operand lhs2 is left-shifted by an expression rhs2 which is greater than or equal to in precision. | -| test.c:107:3:107:14 | left-shift | The operand lhs2 is left-shifted by an expression rhs3 which is greater than or equal to in precision. | -| test.c:109:3:109:14 | left-shift | The operand lhs2 is left-shifted by an expression rhs4 which is greater than or equal to in precision. | -| test.c:111:3:111:14 | left-shift | The operand lhs2 is left-shifted by an expression rhs5 which is greater than or equal to in precision. | -| test.c:113:3:113:14 | left-shift | The operand lhs2 is left-shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:115:3:115:14 | left-shift | The operand lhs2 is left-shifted by an expression rhs7 which is greater than or equal to in precision. | -| test.c:117:3:117:14 | left-shift | The operand lhs2 is left-shifted by an expression rhs8 which is greater than or equal to in precision. | -| test.c:119:3:119:14 | left-shift | The operand lhs2 is left-shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:121:3:121:15 | left-shift | The operand lhs2 is left-shifted by an expression rhs10 which is greater than or equal to in precision. | -| test.c:123:3:123:15 | left-shift | The operand lhs2 is left-shifted by an expression rhs11 which is greater than or equal to in precision. | -| test.c:125:3:125:15 | left-shift | The operand lhs2 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:127:3:127:15 | left-shift | The operand lhs2 is left-shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:129:3:129:15 | left-shift | The operand lhs2 is left-shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:134:3:134:14 | left-shift | The operand lhs3 is left-shifted by an expression rhs3 which is greater than or equal to in precision. | -| test.c:138:3:138:14 | left-shift | The operand lhs3 is left-shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:140:3:140:14 | left-shift | The operand lhs3 is left-shifted by an expression rhs7 which is greater than or equal to in precision. | -| test.c:142:3:142:14 | left-shift | The operand lhs3 is left-shifted by an expression rhs8 which is greater than or equal to in precision. | -| test.c:144:3:144:14 | left-shift | The operand lhs3 is left-shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:146:3:146:15 | left-shift | The operand lhs3 is left-shifted by an expression rhs10 which is greater than or equal to in precision. | -| test.c:148:3:148:15 | left-shift | The operand lhs3 is left-shifted by an expression rhs11 which is greater than or equal to in precision. | -| test.c:150:3:150:15 | left-shift | The operand lhs3 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:152:3:152:15 | left-shift | The operand lhs3 is left-shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:154:3:154:15 | left-shift | The operand lhs3 is left-shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:159:3:159:14 | left-shift | The operand lhs4 is left-shifted by an expression rhs3 which is greater than or equal to in precision. | -| test.c:161:3:161:14 | left-shift | The operand lhs4 is left-shifted by an expression rhs4 which is greater than or equal to in precision. | -| test.c:163:3:163:14 | left-shift | The operand lhs4 is left-shifted by an expression rhs5 which is greater than or equal to in precision. | -| test.c:165:3:165:14 | left-shift | The operand lhs4 is left-shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:167:3:167:14 | left-shift | The operand lhs4 is left-shifted by an expression rhs7 which is greater than or equal to in precision. | -| test.c:169:3:169:14 | left-shift | The operand lhs4 is left-shifted by an expression rhs8 which is greater than or equal to in precision. | -| test.c:171:3:171:14 | left-shift | The operand lhs4 is left-shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:173:3:173:15 | left-shift | The operand lhs4 is left-shifted by an expression rhs10 which is greater than or equal to in precision. | -| test.c:175:3:175:15 | left-shift | The operand lhs4 is left-shifted by an expression rhs11 which is greater than or equal to in precision. | -| test.c:177:3:177:15 | left-shift | The operand lhs4 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:179:3:179:15 | left-shift | The operand lhs4 is left-shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:181:3:181:15 | left-shift | The operand lhs4 is left-shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:186:3:186:14 | left-shift | The operand lhs5 is left-shifted by an expression rhs3 which is greater than or equal to in precision. | -| test.c:188:3:188:14 | left-shift | The operand lhs5 is left-shifted by an expression rhs4 which is greater than or equal to in precision. | -| test.c:190:3:190:14 | left-shift | The operand lhs5 is left-shifted by an expression rhs5 which is greater than or equal to in precision. | -| test.c:192:3:192:14 | left-shift | The operand lhs5 is left-shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:194:3:194:14 | left-shift | The operand lhs5 is left-shifted by an expression rhs7 which is greater than or equal to in precision. | -| test.c:196:3:196:14 | left-shift | The operand lhs5 is left-shifted by an expression rhs8 which is greater than or equal to in precision. | -| test.c:198:3:198:14 | left-shift | The operand lhs5 is left-shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:200:3:200:15 | left-shift | The operand lhs5 is left-shifted by an expression rhs10 which is greater than or equal to in precision. | -| test.c:202:3:202:15 | left-shift | The operand lhs5 is left-shifted by an expression rhs11 which is greater than or equal to in precision. | -| test.c:204:3:204:15 | left-shift | The operand lhs5 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:206:3:206:15 | left-shift | The operand lhs5 is left-shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:208:3:208:15 | left-shift | The operand lhs5 is left-shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:216:3:216:14 | left-shift | The operand lhs6 is left-shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:220:3:220:14 | left-shift | The operand lhs6 is left-shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:224:3:224:15 | left-shift | The operand lhs6 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:226:3:226:15 | left-shift | The operand lhs6 is left-shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:228:3:228:15 | left-shift | The operand lhs6 is left-shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:236:3:236:14 | left-shift | The operand lhs7 is left-shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:238:3:238:14 | left-shift | The operand lhs7 is left-shifted by an expression rhs7 which is greater than or equal to in precision. | -| test.c:240:3:240:14 | left-shift | The operand lhs7 is left-shifted by an expression rhs8 which is greater than or equal to in precision. | -| test.c:242:3:242:14 | left-shift | The operand lhs7 is left-shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:244:3:244:15 | left-shift | The operand lhs7 is left-shifted by an expression rhs10 which is greater than or equal to in precision. | -| test.c:246:3:246:15 | left-shift | The operand lhs7 is left-shifted by an expression rhs11 which is greater than or equal to in precision. | -| test.c:248:3:248:15 | left-shift | The operand lhs7 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:250:3:250:15 | left-shift | The operand lhs7 is left-shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:252:3:252:15 | left-shift | The operand lhs7 is left-shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:260:3:260:14 | left-shift | The operand lhs8 is left-shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:262:3:262:14 | left-shift | The operand lhs8 is left-shifted by an expression rhs7 which is greater than or equal to in precision. | -| test.c:264:3:264:14 | left-shift | The operand lhs8 is left-shifted by an expression rhs8 which is greater than or equal to in precision. | -| test.c:266:3:266:14 | left-shift | The operand lhs8 is left-shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:268:3:268:15 | left-shift | The operand lhs8 is left-shifted by an expression rhs10 which is greater than or equal to in precision. | -| test.c:270:3:270:15 | left-shift | The operand lhs8 is left-shifted by an expression rhs11 which is greater than or equal to in precision. | -| test.c:272:3:272:15 | left-shift | The operand lhs8 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:274:3:274:15 | left-shift | The operand lhs8 is left-shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:276:3:276:15 | left-shift | The operand lhs8 is left-shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:292:3:292:15 | left-shift | The operand lhs9 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:316:3:316:16 | left-shift | The operand lhs10 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:318:3:318:16 | left-shift | The operand lhs10 is left-shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:320:3:320:16 | left-shift | The operand lhs10 is left-shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:340:3:340:16 | left-shift | The operand lhs11 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:342:3:342:16 | left-shift | The operand lhs11 is left-shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:344:3:344:16 | left-shift | The operand lhs11 is left-shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:358:3:358:16 | left-shift | The operand lhs12 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:374:3:374:16 | left-shift | The operand lhs13 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:376:3:376:16 | left-shift | The operand lhs13 is left-shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:378:3:378:16 | left-shift | The operand lhs13 is left-shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:392:3:392:16 | left-shift | The operand lhs14 is left-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:394:3:394:16 | left-shift | The operand lhs14 is left-shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:396:3:396:16 | left-shift | The operand lhs14 is left-shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:1579:3:1580:10 | right-shift | The operand lhs0 is right-shifted by an expression rhs0 which is greater than or equal to in precision. | -| test.c:1583:3:1584:10 | right-shift | The operand lhs0 is right-shifted by an expression rhs3 which is greater than or equal to in precision. | -| test.c:1585:3:1586:10 | right-shift | The operand lhs0 is right-shifted by an expression rhs4 which is greater than or equal to in precision. | -| test.c:1587:3:1588:10 | right-shift | The operand lhs0 is right-shifted by an expression rhs5 which is greater than or equal to in precision. | -| test.c:1589:3:1590:10 | right-shift | The operand lhs0 is right-shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:1591:3:1592:10 | right-shift | The operand lhs0 is right-shifted by an expression rhs7 which is greater than or equal to in precision. | -| test.c:1593:3:1594:10 | right-shift | The operand lhs0 is right-shifted by an expression rhs8 which is greater than or equal to in precision. | -| test.c:1595:3:1596:10 | right-shift | The operand lhs0 is right-shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:1597:3:1597:15 | right-shift | The operand lhs0 is right-shifted by an expression rhs10 which is greater than or equal to in precision. | -| test.c:1599:3:1599:15 | right-shift | The operand lhs0 is right-shifted by an expression rhs11 which is greater than or equal to in precision. | -| test.c:1601:3:1601:15 | right-shift | The operand lhs0 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:1603:3:1603:15 | right-shift | The operand lhs0 is right-shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:1605:3:1605:15 | right-shift | The operand lhs0 is right-shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:1607:3:1608:10 | right-shift | The operand lhs1 is right-shifted by an expression rhs0 which is greater than or equal to in precision. | -| test.c:1609:3:1610:10 | right-shift | The operand lhs1 is right-shifted by an expression rhs1 which is greater than or equal to in precision. | -| test.c:1611:3:1612:10 | right-shift | The operand lhs1 is right-shifted by an expression rhs2 which is greater than or equal to in precision. | -| test.c:1613:3:1614:10 | right-shift | The operand lhs1 is right-shifted by an expression rhs3 which is greater than or equal to in precision. | -| test.c:1615:3:1616:10 | right-shift | The operand lhs1 is right-shifted by an expression rhs4 which is greater than or equal to in precision. | -| test.c:1617:3:1618:10 | right-shift | The operand lhs1 is right-shifted by an expression rhs5 which is greater than or equal to in precision. | -| test.c:1619:3:1620:10 | right-shift | The operand lhs1 is right-shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:1621:3:1622:10 | right-shift | The operand lhs1 is right-shifted by an expression rhs7 which is greater than or equal to in precision. | -| test.c:1623:3:1624:10 | right-shift | The operand lhs1 is right-shifted by an expression rhs8 which is greater than or equal to in precision. | -| test.c:1625:3:1626:10 | right-shift | The operand lhs1 is right-shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:1627:3:1627:15 | right-shift | The operand lhs1 is right-shifted by an expression rhs10 which is greater than or equal to in precision. | -| test.c:1629:3:1629:15 | right-shift | The operand lhs1 is right-shifted by an expression rhs11 which is greater than or equal to in precision. | -| test.c:1631:3:1631:15 | right-shift | The operand lhs1 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:1633:3:1633:15 | right-shift | The operand lhs1 is right-shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:1635:3:1635:15 | right-shift | The operand lhs1 is right-shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:1637:3:1638:10 | right-shift | The operand lhs2 is right-shifted by an expression rhs0 which is greater than or equal to in precision. | -| test.c:1639:3:1640:10 | right-shift | The operand lhs2 is right-shifted by an expression rhs1 which is greater than or equal to in precision. | -| test.c:1641:3:1642:10 | right-shift | The operand lhs2 is right-shifted by an expression rhs2 which is greater than or equal to in precision. | -| test.c:1643:3:1644:10 | right-shift | The operand lhs2 is right-shifted by an expression rhs3 which is greater than or equal to in precision. | -| test.c:1645:3:1646:10 | right-shift | The operand lhs2 is right-shifted by an expression rhs4 which is greater than or equal to in precision. | -| test.c:1647:3:1648:10 | right-shift | The operand lhs2 is right-shifted by an expression rhs5 which is greater than or equal to in precision. | -| test.c:1649:3:1650:10 | right-shift | The operand lhs2 is right-shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:1651:3:1652:10 | right-shift | The operand lhs2 is right-shifted by an expression rhs7 which is greater than or equal to in precision. | -| test.c:1653:3:1654:10 | right-shift | The operand lhs2 is right-shifted by an expression rhs8 which is greater than or equal to in precision. | -| test.c:1655:3:1656:10 | right-shift | The operand lhs2 is right-shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:1657:3:1657:15 | right-shift | The operand lhs2 is right-shifted by an expression rhs10 which is greater than or equal to in precision. | -| test.c:1659:3:1659:15 | right-shift | The operand lhs2 is right-shifted by an expression rhs11 which is greater than or equal to in precision. | -| test.c:1661:3:1661:15 | right-shift | The operand lhs2 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:1663:3:1663:15 | right-shift | The operand lhs2 is right-shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:1665:3:1665:15 | right-shift | The operand lhs2 is right-shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:1670:3:1671:10 | right-shift | The operand lhs3 is right-shifted by an expression rhs3 which is greater than or equal to in precision. | -| test.c:1674:3:1675:10 | right-shift | The operand lhs3 is right-shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:1676:3:1677:10 | right-shift | The operand lhs3 is right-shifted by an expression rhs7 which is greater than or equal to in precision. | -| test.c:1678:3:1679:10 | right-shift | The operand lhs3 is right-shifted by an expression rhs8 which is greater than or equal to in precision. | -| test.c:1680:3:1681:10 | right-shift | The operand lhs3 is right-shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:1682:3:1682:15 | right-shift | The operand lhs3 is right-shifted by an expression rhs10 which is greater than or equal to in precision. | -| test.c:1684:3:1684:15 | right-shift | The operand lhs3 is right-shifted by an expression rhs11 which is greater than or equal to in precision. | -| test.c:1686:3:1686:15 | right-shift | The operand lhs3 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:1688:3:1688:15 | right-shift | The operand lhs3 is right-shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:1690:3:1690:15 | right-shift | The operand lhs3 is right-shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:1695:3:1696:10 | right-shift | The operand lhs4 is right-shifted by an expression rhs3 which is greater than or equal to in precision. | -| test.c:1697:3:1698:10 | right-shift | The operand lhs4 is right-shifted by an expression rhs4 which is greater than or equal to in precision. | -| test.c:1699:3:1700:10 | right-shift | The operand lhs4 is right-shifted by an expression rhs5 which is greater than or equal to in precision. | -| test.c:1701:3:1702:10 | right-shift | The operand lhs4 is right-shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:1703:3:1704:10 | right-shift | The operand lhs4 is right-shifted by an expression rhs7 which is greater than or equal to in precision. | -| test.c:1705:3:1706:10 | right-shift | The operand lhs4 is right-shifted by an expression rhs8 which is greater than or equal to in precision. | -| test.c:1707:3:1708:10 | right-shift | The operand lhs4 is right-shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:1709:3:1709:15 | right-shift | The operand lhs4 is right-shifted by an expression rhs10 which is greater than or equal to in precision. | -| test.c:1711:3:1711:15 | right-shift | The operand lhs4 is right-shifted by an expression rhs11 which is greater than or equal to in precision. | -| test.c:1713:3:1713:15 | right-shift | The operand lhs4 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:1715:3:1715:15 | right-shift | The operand lhs4 is right-shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:1717:3:1717:15 | right-shift | The operand lhs4 is right-shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:1722:3:1723:10 | right-shift | The operand lhs5 is right-shifted by an expression rhs3 which is greater than or equal to in precision. | -| test.c:1724:3:1725:10 | right-shift | The operand lhs5 is right-shifted by an expression rhs4 which is greater than or equal to in precision. | -| test.c:1726:3:1727:10 | right-shift | The operand lhs5 is right-shifted by an expression rhs5 which is greater than or equal to in precision. | -| test.c:1728:3:1729:10 | right-shift | The operand lhs5 is right-shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:1730:3:1731:10 | right-shift | The operand lhs5 is right-shifted by an expression rhs7 which is greater than or equal to in precision. | -| test.c:1732:3:1733:10 | right-shift | The operand lhs5 is right-shifted by an expression rhs8 which is greater than or equal to in precision. | -| test.c:1734:3:1735:10 | right-shift | The operand lhs5 is right-shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:1736:3:1736:15 | right-shift | The operand lhs5 is right-shifted by an expression rhs10 which is greater than or equal to in precision. | -| test.c:1738:3:1738:15 | right-shift | The operand lhs5 is right-shifted by an expression rhs11 which is greater than or equal to in precision. | -| test.c:1740:3:1740:15 | right-shift | The operand lhs5 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:1742:3:1742:15 | right-shift | The operand lhs5 is right-shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:1744:3:1744:15 | right-shift | The operand lhs5 is right-shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:1752:3:1753:10 | right-shift | The operand lhs6 is right-shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:1756:3:1757:10 | right-shift | The operand lhs6 is right-shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:1760:3:1760:15 | right-shift | The operand lhs6 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:1762:3:1762:15 | right-shift | The operand lhs6 is right-shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:1764:3:1764:15 | right-shift | The operand lhs6 is right-shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:1772:3:1773:10 | right-shift | The operand lhs7 is right-shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:1774:3:1775:10 | right-shift | The operand lhs7 is right-shifted by an expression rhs7 which is greater than or equal to in precision. | -| test.c:1776:3:1777:10 | right-shift | The operand lhs7 is right-shifted by an expression rhs8 which is greater than or equal to in precision. | -| test.c:1778:3:1779:10 | right-shift | The operand lhs7 is right-shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:1780:3:1780:15 | right-shift | The operand lhs7 is right-shifted by an expression rhs10 which is greater than or equal to in precision. | -| test.c:1782:3:1782:15 | right-shift | The operand lhs7 is right-shifted by an expression rhs11 which is greater than or equal to in precision. | -| test.c:1784:3:1784:15 | right-shift | The operand lhs7 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:1786:3:1786:15 | right-shift | The operand lhs7 is right-shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:1788:3:1788:15 | right-shift | The operand lhs7 is right-shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:1796:3:1797:10 | right-shift | The operand lhs8 is right-shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:1798:3:1799:10 | right-shift | The operand lhs8 is right-shifted by an expression rhs7 which is greater than or equal to in precision. | -| test.c:1800:3:1801:10 | right-shift | The operand lhs8 is right-shifted by an expression rhs8 which is greater than or equal to in precision. | -| test.c:1802:3:1803:10 | right-shift | The operand lhs8 is right-shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:1804:3:1804:15 | right-shift | The operand lhs8 is right-shifted by an expression rhs10 which is greater than or equal to in precision. | -| test.c:1806:3:1806:15 | right-shift | The operand lhs8 is right-shifted by an expression rhs11 which is greater than or equal to in precision. | -| test.c:1808:3:1808:15 | right-shift | The operand lhs8 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:1810:3:1810:15 | right-shift | The operand lhs8 is right-shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:1812:3:1812:15 | right-shift | The operand lhs8 is right-shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:1828:3:1828:15 | right-shift | The operand lhs9 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:1852:3:1852:16 | right-shift | The operand lhs10 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:1854:3:1854:16 | right-shift | The operand lhs10 is right-shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:1856:3:1856:16 | right-shift | The operand lhs10 is right-shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:1876:3:1876:16 | right-shift | The operand lhs11 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:1878:3:1878:16 | right-shift | The operand lhs11 is right-shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:1880:3:1880:16 | right-shift | The operand lhs11 is right-shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:1894:3:1894:16 | right-shift | The operand lhs12 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:1910:3:1910:16 | right-shift | The operand lhs13 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:1912:3:1912:16 | right-shift | The operand lhs13 is right-shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:1914:3:1914:16 | right-shift | The operand lhs13 is right-shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:1928:3:1928:16 | right-shift | The operand lhs14 is right-shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:1930:3:1930:16 | right-shift | The operand lhs14 is right-shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:1932:3:1932:16 | right-shift | The operand lhs14 is right-shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:3115:3:3115:12 | left-shift | The operand lhs0 is left-shifted by a negative expression - .... | -| test.c:3116:3:3116:12 | left-shift | The operand lhs1 is left-shifted by a negative expression - .... | -| test.c:3117:3:3117:12 | left-shift | The operand lhs2 is left-shifted by a negative expression - .... | -| test.c:3118:3:3118:12 | left-shift | The operand lhs3 is left-shifted by a negative expression - .... | -| test.c:3119:3:3119:12 | left-shift | The operand lhs4 is left-shifted by a negative expression - .... | -| test.c:3120:3:3120:12 | left-shift | The operand lhs5 is left-shifted by a negative expression - .... | -| test.c:3121:3:3121:12 | left-shift | The operand lhs6 is left-shifted by a negative expression - .... | -| test.c:3122:3:3122:12 | left-shift | The operand lhs7 is left-shifted by a negative expression - .... | -| test.c:3123:3:3123:12 | left-shift | The operand lhs8 is left-shifted by a negative expression - .... | -| test.c:3124:3:3124:12 | left-shift | The operand lhs9 is left-shifted by a negative expression - .... | -| test.c:3125:3:3125:13 | left-shift | The operand lhs10 is left-shifted by a negative expression - .... | -| test.c:3126:3:3126:13 | left-shift | The operand lhs11 is left-shifted by a negative expression - .... | -| test.c:3127:3:3127:13 | left-shift | The operand lhs12 is left-shifted by a negative expression - .... | -| test.c:3128:3:3128:13 | left-shift | The operand lhs13 is left-shifted by a negative expression - .... | -| test.c:3129:3:3129:13 | left-shift | The operand lhs14 is left-shifted by a negative expression - .... | \ No newline at end of file +| test.c:43:3:43:14 | ... << ... | The operand lhs0 is shifted by an expression rhs0 which is greater than or equal to in precision. | +| test.c:47:3:47:14 | ... << ... | The operand lhs0 is shifted by an expression rhs3 which is greater than or equal to in precision. | +| test.c:49:3:49:14 | ... << ... | The operand lhs0 is shifted by an expression rhs4 which is greater than or equal to in precision. | +| test.c:51:3:51:14 | ... << ... | The operand lhs0 is shifted by an expression rhs5 which is greater than or equal to in precision. | +| test.c:53:3:53:14 | ... << ... | The operand lhs0 is shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:55:3:55:14 | ... << ... | The operand lhs0 is shifted by an expression rhs7 which is greater than or equal to in precision. | +| test.c:57:3:57:14 | ... << ... | The operand lhs0 is shifted by an expression rhs8 which is greater than or equal to in precision. | +| test.c:59:3:59:14 | ... << ... | The operand lhs0 is shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:61:3:61:15 | ... << ... | The operand lhs0 is shifted by an expression rhs10 which is greater than or equal to in precision. | +| test.c:63:3:63:15 | ... << ... | The operand lhs0 is shifted by an expression rhs11 which is greater than or equal to in precision. | +| test.c:65:3:65:15 | ... << ... | The operand lhs0 is shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:67:3:67:15 | ... << ... | The operand lhs0 is shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:69:3:69:15 | ... << ... | The operand lhs0 is shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:71:3:71:14 | ... << ... | The operand lhs1 is shifted by an expression rhs0 which is greater than or equal to in precision. | +| test.c:73:3:73:14 | ... << ... | The operand lhs1 is shifted by an expression rhs1 which is greater than or equal to in precision. | +| test.c:75:3:75:14 | ... << ... | The operand lhs1 is shifted by an expression rhs2 which is greater than or equal to in precision. | +| test.c:77:3:77:14 | ... << ... | The operand lhs1 is shifted by an expression rhs3 which is greater than or equal to in precision. | +| test.c:79:3:79:14 | ... << ... | The operand lhs1 is shifted by an expression rhs4 which is greater than or equal to in precision. | +| test.c:81:3:81:14 | ... << ... | The operand lhs1 is shifted by an expression rhs5 which is greater than or equal to in precision. | +| test.c:83:3:83:14 | ... << ... | The operand lhs1 is shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:85:3:85:14 | ... << ... | The operand lhs1 is shifted by an expression rhs7 which is greater than or equal to in precision. | +| test.c:87:3:87:14 | ... << ... | The operand lhs1 is shifted by an expression rhs8 which is greater than or equal to in precision. | +| test.c:89:3:89:14 | ... << ... | The operand lhs1 is shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:91:3:91:15 | ... << ... | The operand lhs1 is shifted by an expression rhs10 which is greater than or equal to in precision. | +| test.c:93:3:93:15 | ... << ... | The operand lhs1 is shifted by an expression rhs11 which is greater than or equal to in precision. | +| test.c:95:3:95:15 | ... << ... | The operand lhs1 is shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:97:3:97:15 | ... << ... | The operand lhs1 is shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:99:3:99:15 | ... << ... | The operand lhs1 is shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:134:3:134:14 | ... << ... | The operand lhs3 is shifted by an expression rhs3 which is greater than or equal to in precision. | +| test.c:138:3:138:14 | ... << ... | The operand lhs3 is shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:140:3:140:14 | ... << ... | The operand lhs3 is shifted by an expression rhs7 which is greater than or equal to in precision. | +| test.c:142:3:142:14 | ... << ... | The operand lhs3 is shifted by an expression rhs8 which is greater than or equal to in precision. | +| test.c:144:3:144:14 | ... << ... | The operand lhs3 is shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:146:3:146:15 | ... << ... | The operand lhs3 is shifted by an expression rhs10 which is greater than or equal to in precision. | +| test.c:148:3:148:15 | ... << ... | The operand lhs3 is shifted by an expression rhs11 which is greater than or equal to in precision. | +| test.c:150:3:150:15 | ... << ... | The operand lhs3 is shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:152:3:152:15 | ... << ... | The operand lhs3 is shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:154:3:154:15 | ... << ... | The operand lhs3 is shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:159:3:159:14 | ... << ... | The operand lhs4 is shifted by an expression rhs3 which is greater than or equal to in precision. | +| test.c:161:3:161:14 | ... << ... | The operand lhs4 is shifted by an expression rhs4 which is greater than or equal to in precision. | +| test.c:163:3:163:14 | ... << ... | The operand lhs4 is shifted by an expression rhs5 which is greater than or equal to in precision. | +| test.c:165:3:165:14 | ... << ... | The operand lhs4 is shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:167:3:167:14 | ... << ... | The operand lhs4 is shifted by an expression rhs7 which is greater than or equal to in precision. | +| test.c:169:3:169:14 | ... << ... | The operand lhs4 is shifted by an expression rhs8 which is greater than or equal to in precision. | +| test.c:171:3:171:14 | ... << ... | The operand lhs4 is shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:173:3:173:15 | ... << ... | The operand lhs4 is shifted by an expression rhs10 which is greater than or equal to in precision. | +| test.c:175:3:175:15 | ... << ... | The operand lhs4 is shifted by an expression rhs11 which is greater than or equal to in precision. | +| test.c:177:3:177:15 | ... << ... | The operand lhs4 is shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:179:3:179:15 | ... << ... | The operand lhs4 is shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:181:3:181:15 | ... << ... | The operand lhs4 is shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:216:3:216:14 | ... << ... | The operand lhs6 is shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:220:3:220:14 | ... << ... | The operand lhs6 is shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:224:3:224:15 | ... << ... | The operand lhs6 is shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:226:3:226:15 | ... << ... | The operand lhs6 is shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:228:3:228:15 | ... << ... | The operand lhs6 is shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:236:3:236:14 | ... << ... | The operand lhs7 is shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:238:3:238:14 | ... << ... | The operand lhs7 is shifted by an expression rhs7 which is greater than or equal to in precision. | +| test.c:240:3:240:14 | ... << ... | The operand lhs7 is shifted by an expression rhs8 which is greater than or equal to in precision. | +| test.c:242:3:242:14 | ... << ... | The operand lhs7 is shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:244:3:244:15 | ... << ... | The operand lhs7 is shifted by an expression rhs10 which is greater than or equal to in precision. | +| test.c:246:3:246:15 | ... << ... | The operand lhs7 is shifted by an expression rhs11 which is greater than or equal to in precision. | +| test.c:248:3:248:15 | ... << ... | The operand lhs7 is shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:250:3:250:15 | ... << ... | The operand lhs7 is shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:252:3:252:15 | ... << ... | The operand lhs7 is shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:292:3:292:15 | ... << ... | The operand lhs9 is shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:316:3:316:16 | ... << ... | The operand lhs10 is shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:318:3:318:16 | ... << ... | The operand lhs10 is shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:320:3:320:16 | ... << ... | The operand lhs10 is shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:358:3:358:16 | ... << ... | The operand lhs12 is shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:374:3:374:16 | ... << ... | The operand lhs13 is shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:376:3:376:16 | ... << ... | The operand lhs13 is shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:378:3:378:16 | ... << ... | The operand lhs13 is shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:1579:3:1580:10 | ... >> ... | The operand lhs0 is shifted by an expression rhs0 which is greater than or equal to in precision. | +| test.c:1583:3:1584:10 | ... >> ... | The operand lhs0 is shifted by an expression rhs3 which is greater than or equal to in precision. | +| test.c:1585:3:1586:10 | ... >> ... | The operand lhs0 is shifted by an expression rhs4 which is greater than or equal to in precision. | +| test.c:1587:3:1588:10 | ... >> ... | The operand lhs0 is shifted by an expression rhs5 which is greater than or equal to in precision. | +| test.c:1589:3:1590:10 | ... >> ... | The operand lhs0 is shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:1591:3:1592:10 | ... >> ... | The operand lhs0 is shifted by an expression rhs7 which is greater than or equal to in precision. | +| test.c:1593:3:1594:10 | ... >> ... | The operand lhs0 is shifted by an expression rhs8 which is greater than or equal to in precision. | +| test.c:1595:3:1596:10 | ... >> ... | The operand lhs0 is shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:1597:3:1597:15 | ... >> ... | The operand lhs0 is shifted by an expression rhs10 which is greater than or equal to in precision. | +| test.c:1599:3:1599:15 | ... >> ... | The operand lhs0 is shifted by an expression rhs11 which is greater than or equal to in precision. | +| test.c:1601:3:1601:15 | ... >> ... | The operand lhs0 is shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:1603:3:1603:15 | ... >> ... | The operand lhs0 is shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:1605:3:1605:15 | ... >> ... | The operand lhs0 is shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:1607:3:1608:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs0 which is greater than or equal to in precision. | +| test.c:1609:3:1610:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs1 which is greater than or equal to in precision. | +| test.c:1611:3:1612:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs2 which is greater than or equal to in precision. | +| test.c:1613:3:1614:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs3 which is greater than or equal to in precision. | +| test.c:1615:3:1616:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs4 which is greater than or equal to in precision. | +| test.c:1617:3:1618:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs5 which is greater than or equal to in precision. | +| test.c:1619:3:1620:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:1621:3:1622:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs7 which is greater than or equal to in precision. | +| test.c:1623:3:1624:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs8 which is greater than or equal to in precision. | +| test.c:1625:3:1626:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:1627:3:1627:15 | ... >> ... | The operand lhs1 is shifted by an expression rhs10 which is greater than or equal to in precision. | +| test.c:1629:3:1629:15 | ... >> ... | The operand lhs1 is shifted by an expression rhs11 which is greater than or equal to in precision. | +| test.c:1631:3:1631:15 | ... >> ... | The operand lhs1 is shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:1633:3:1633:15 | ... >> ... | The operand lhs1 is shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:1635:3:1635:15 | ... >> ... | The operand lhs1 is shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:1670:3:1671:10 | ... >> ... | The operand lhs3 is shifted by an expression rhs3 which is greater than or equal to in precision. | +| test.c:1674:3:1675:10 | ... >> ... | The operand lhs3 is shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:1676:3:1677:10 | ... >> ... | The operand lhs3 is shifted by an expression rhs7 which is greater than or equal to in precision. | +| test.c:1678:3:1679:10 | ... >> ... | The operand lhs3 is shifted by an expression rhs8 which is greater than or equal to in precision. | +| test.c:1680:3:1681:10 | ... >> ... | The operand lhs3 is shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:1682:3:1682:15 | ... >> ... | The operand lhs3 is shifted by an expression rhs10 which is greater than or equal to in precision. | +| test.c:1684:3:1684:15 | ... >> ... | The operand lhs3 is shifted by an expression rhs11 which is greater than or equal to in precision. | +| test.c:1686:3:1686:15 | ... >> ... | The operand lhs3 is shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:1688:3:1688:15 | ... >> ... | The operand lhs3 is shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:1690:3:1690:15 | ... >> ... | The operand lhs3 is shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:1695:3:1696:10 | ... >> ... | The operand lhs4 is shifted by an expression rhs3 which is greater than or equal to in precision. | +| test.c:1697:3:1698:10 | ... >> ... | The operand lhs4 is shifted by an expression rhs4 which is greater than or equal to in precision. | +| test.c:1699:3:1700:10 | ... >> ... | The operand lhs4 is shifted by an expression rhs5 which is greater than or equal to in precision. | +| test.c:1701:3:1702:10 | ... >> ... | The operand lhs4 is shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:1703:3:1704:10 | ... >> ... | The operand lhs4 is shifted by an expression rhs7 which is greater than or equal to in precision. | +| test.c:1705:3:1706:10 | ... >> ... | The operand lhs4 is shifted by an expression rhs8 which is greater than or equal to in precision. | +| test.c:1707:3:1708:10 | ... >> ... | The operand lhs4 is shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:1709:3:1709:15 | ... >> ... | The operand lhs4 is shifted by an expression rhs10 which is greater than or equal to in precision. | +| test.c:1711:3:1711:15 | ... >> ... | The operand lhs4 is shifted by an expression rhs11 which is greater than or equal to in precision. | +| test.c:1713:3:1713:15 | ... >> ... | The operand lhs4 is shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:1715:3:1715:15 | ... >> ... | The operand lhs4 is shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:1717:3:1717:15 | ... >> ... | The operand lhs4 is shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:1752:3:1753:10 | ... >> ... | The operand lhs6 is shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:1756:3:1757:10 | ... >> ... | The operand lhs6 is shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:1760:3:1760:15 | ... >> ... | The operand lhs6 is shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:1762:3:1762:15 | ... >> ... | The operand lhs6 is shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:1764:3:1764:15 | ... >> ... | The operand lhs6 is shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:1772:3:1773:10 | ... >> ... | The operand lhs7 is shifted by an expression rhs6 which is greater than or equal to in precision. | +| test.c:1774:3:1775:10 | ... >> ... | The operand lhs7 is shifted by an expression rhs7 which is greater than or equal to in precision. | +| test.c:1776:3:1777:10 | ... >> ... | The operand lhs7 is shifted by an expression rhs8 which is greater than or equal to in precision. | +| test.c:1778:3:1779:10 | ... >> ... | The operand lhs7 is shifted by an expression rhs9 which is greater than or equal to in precision. | +| test.c:1780:3:1780:15 | ... >> ... | The operand lhs7 is shifted by an expression rhs10 which is greater than or equal to in precision. | +| test.c:1782:3:1782:15 | ... >> ... | The operand lhs7 is shifted by an expression rhs11 which is greater than or equal to in precision. | +| test.c:1784:3:1784:15 | ... >> ... | The operand lhs7 is shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:1786:3:1786:15 | ... >> ... | The operand lhs7 is shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:1788:3:1788:15 | ... >> ... | The operand lhs7 is shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:1828:3:1828:15 | ... >> ... | The operand lhs9 is shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:1852:3:1852:16 | ... >> ... | The operand lhs10 is shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:1854:3:1854:16 | ... >> ... | The operand lhs10 is shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:1856:3:1856:16 | ... >> ... | The operand lhs10 is shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:1894:3:1894:16 | ... >> ... | The operand lhs12 is shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:1910:3:1910:16 | ... >> ... | The operand lhs13 is shifted by an expression rhs12 which is greater than or equal to in precision. | +| test.c:1912:3:1912:16 | ... >> ... | The operand lhs13 is shifted by an expression rhs13 which is greater than or equal to in precision. | +| test.c:1914:3:1914:16 | ... >> ... | The operand lhs13 is shifted by an expression rhs14 which is greater than or equal to in precision. | +| test.c:3115:3:3115:12 | ... << ... | The operand lhs0 is shifted by a negative expression - .... | +| test.c:3116:3:3116:12 | ... << ... | The operand lhs1 is shifted by a negative expression - .... | +| test.c:3117:3:3117:12 | ... << ... | The operand lhs2 is shifted by a negative expression - .... | +| test.c:3118:3:3118:12 | ... << ... | The operand lhs3 is shifted by a negative expression - .... | +| test.c:3119:3:3119:12 | ... << ... | The operand lhs4 is shifted by a negative expression - .... | +| test.c:3120:3:3120:12 | ... << ... | The operand lhs5 is shifted by a negative expression - .... | +| test.c:3121:3:3121:12 | ... << ... | The operand lhs6 is shifted by a negative expression - .... | +| test.c:3122:3:3122:12 | ... << ... | The operand lhs7 is shifted by a negative expression - .... | +| test.c:3123:3:3123:12 | ... << ... | The operand lhs8 is shifted by a negative expression - .... | +| test.c:3124:3:3124:12 | ... << ... | The operand lhs9 is shifted by a negative expression - .... | +| test.c:3125:3:3125:13 | ... << ... | The operand lhs10 is shifted by a negative expression - .... | +| test.c:3126:3:3126:13 | ... << ... | The operand lhs11 is shifted by a negative expression - .... | +| test.c:3127:3:3127:13 | ... << ... | The operand lhs12 is shifted by a negative expression - .... | +| test.c:3128:3:3128:13 | ... << ... | The operand lhs13 is shifted by a negative expression - .... | +| test.c:3129:3:3129:13 | ... << ... | The operand lhs14 is shifted by a negative expression - .... | diff --git a/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql b/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql index a295c91f7b..35b43f8323 100644 --- a/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql +++ b/c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql @@ -28,12 +28,6 @@ class GenericCharPointerType extends PointerType { /* This type eventually resolves to char* */ this.resolveTypedefs*() instanceof CharPointerType } - - predicate isWideCharPointerType() { this.resolveTypedefs*() instanceof WideCharPointerType } - - override string toString() { - if this.isWideCharPointerType() then result = "wchar_t*" else result = "char*" - } } class NonConstCharStarType extends Type { @@ -47,8 +41,7 @@ class NonConstCharStarType extends Type { predicate declaringNonConstCharVar(Variable decl, string message) { not decl instanceof Parameter and // exclude parameters /* It should be declaring a char* type variable */ - decl.getType() instanceof GenericCharPointerType and - not decl.getType().isDeeplyConstBelow() and + decl.getType() instanceof NonConstCharStarType and /* But it's declared to hold a string literal. */ decl.getInitializer().getExpr() instanceof StringLiteral and message = diff --git a/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.expected b/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.expected index 1312594e13..46b8e5a47b 100644 --- a/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.expected +++ b/c/misra/test/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.expected @@ -1,8 +1,8 @@ -| test.c:11:9:11:10 | s3 | char* variable s3 is declared with a string literal. | -| test.c:13:3:14:15 | ... = ... | char* variable s3 is assigned a string literal. | -| test.c:23:12:23:14 | ws3 | wchar_t* variable ws3 is declared with a string literal. | -| test.c:25:3:25:23 | ... = ... | wchar_t* variable ws3 is assigned a string literal. | -| test.c:50:5:50:21 | return ... | char* function sample3 is returning a string literal. | -| test.c:58:5:58:22 | return ... | wchar_t* function w_sample3 is returning a string literal. | -| test.c:69:3:69:9 | call to sample4 | char* parameter of sample4 is passed a string literal. | -| test.c:78:3:78:11 | call to w_sample4 | wchar_t* parameter of w_sample4 is passed a string literal. | +| test.c:11:9:11:10 | s3 | char * variable s3 is declared with a string literal. | +| test.c:13:3:14:15 | ... = ... | char * variable s3 is assigned a string literal. | +| test.c:23:12:23:14 | ws3 | wchar_t * variable ws3 is declared with a string literal. | +| test.c:25:3:25:23 | ... = ... | wchar_t * variable ws3 is assigned a string literal. | +| test.c:50:5:50:21 | return ... | char * function sample3 is returning a string literal. | +| test.c:58:5:58:22 | return ... | wchar_t * function w_sample3 is returning a string literal. | +| test.c:69:3:69:9 | call to sample4 | char * parameter of sample4 is passed a string literal. | +| test.c:78:3:78:11 | call to w_sample4 | wchar_t * parameter of w_sample4 is passed a string literal. | From b79e1e84b6f0611c774088e49fb5b0b4a025b9ba Mon Sep 17 00:00:00 2001 From: Luke Cartey Date: Wed, 29 Mar 2023 10:34:35 +0100 Subject: [PATCH 50/53] INT34-C: Use fully converted type for precision If the expression is explicitly converted to a larger type, the shift happens on the larger type. --- .../INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql b/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql index c53e480aac..ef5f2a4c5a 100644 --- a/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql +++ b/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql @@ -55,7 +55,7 @@ int getPrecision(IntegralType type) { predicate isForbiddenShiftExpr(BitShiftExpr shift, string message) { ( ( - getPrecision(shift.getLeftOperand().getUnderlyingType()) <= + getPrecision(shift.getLeftOperand().getFullyConverted().getUnderlyingType()) <= upperBound(shift.getRightOperand()) and message = "The operand " + shift.getLeftOperand() + " is shifted by an expression " + From 4e5e05a8caeffb7ef0244696796191fdaa5c35c1 Mon Sep 17 00:00:00 2001 From: Luke Cartey Date: Wed, 29 Mar 2023 10:45:56 +0100 Subject: [PATCH 51/53] INT34-C: Improve alert message. * Include uncertainty in the alert message (e.g. "may") * Report upper bound if relevant. --- ...ftedbyNegativeOrGreaterPrecisionOperand.ql | 9 +- ...NegativeOrGreaterPrecisionOperand.expected | 318 +++++++++--------- 2 files changed, 164 insertions(+), 163 deletions(-) diff --git a/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql b/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql index ef5f2a4c5a..2086d2da2b 100644 --- a/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql +++ b/c/cert/src/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql @@ -55,16 +55,17 @@ int getPrecision(IntegralType type) { predicate isForbiddenShiftExpr(BitShiftExpr shift, string message) { ( ( - getPrecision(shift.getLeftOperand().getFullyConverted().getUnderlyingType()) <= + getPrecision(shift.getLeftOperand().getExplicitlyConverted().getUnderlyingType()) <= upperBound(shift.getRightOperand()) and message = "The operand " + shift.getLeftOperand() + " is shifted by an expression " + - shift.getRightOperand() + " which is greater than or equal to in precision." + shift.getRightOperand() + " whose upper bound (" + upperBound(shift.getRightOperand()) + + ") is greater than or equal to the precision." or lowerBound(shift.getRightOperand()) < 0 and message = - "The operand " + shift.getLeftOperand() + " is shifted by a negative expression " + - shift.getRightOperand() + "." + "The operand " + shift.getLeftOperand() + " is shifted by an expression " + + shift.getRightOperand() + " which may be negative." ) and /* * Shift statement is not at a basic block where diff --git a/c/cert/test/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.expected b/c/cert/test/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.expected index 4d82ab7839..0cd42bb3e0 100644 --- a/c/cert/test/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.expected +++ b/c/cert/test/rules/INT34-C/ExprShiftedbyNegativeOrGreaterPrecisionOperand.expected @@ -1,159 +1,159 @@ -| test.c:43:3:43:14 | ... << ... | The operand lhs0 is shifted by an expression rhs0 which is greater than or equal to in precision. | -| test.c:47:3:47:14 | ... << ... | The operand lhs0 is shifted by an expression rhs3 which is greater than or equal to in precision. | -| test.c:49:3:49:14 | ... << ... | The operand lhs0 is shifted by an expression rhs4 which is greater than or equal to in precision. | -| test.c:51:3:51:14 | ... << ... | The operand lhs0 is shifted by an expression rhs5 which is greater than or equal to in precision. | -| test.c:53:3:53:14 | ... << ... | The operand lhs0 is shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:55:3:55:14 | ... << ... | The operand lhs0 is shifted by an expression rhs7 which is greater than or equal to in precision. | -| test.c:57:3:57:14 | ... << ... | The operand lhs0 is shifted by an expression rhs8 which is greater than or equal to in precision. | -| test.c:59:3:59:14 | ... << ... | The operand lhs0 is shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:61:3:61:15 | ... << ... | The operand lhs0 is shifted by an expression rhs10 which is greater than or equal to in precision. | -| test.c:63:3:63:15 | ... << ... | The operand lhs0 is shifted by an expression rhs11 which is greater than or equal to in precision. | -| test.c:65:3:65:15 | ... << ... | The operand lhs0 is shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:67:3:67:15 | ... << ... | The operand lhs0 is shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:69:3:69:15 | ... << ... | The operand lhs0 is shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:71:3:71:14 | ... << ... | The operand lhs1 is shifted by an expression rhs0 which is greater than or equal to in precision. | -| test.c:73:3:73:14 | ... << ... | The operand lhs1 is shifted by an expression rhs1 which is greater than or equal to in precision. | -| test.c:75:3:75:14 | ... << ... | The operand lhs1 is shifted by an expression rhs2 which is greater than or equal to in precision. | -| test.c:77:3:77:14 | ... << ... | The operand lhs1 is shifted by an expression rhs3 which is greater than or equal to in precision. | -| test.c:79:3:79:14 | ... << ... | The operand lhs1 is shifted by an expression rhs4 which is greater than or equal to in precision. | -| test.c:81:3:81:14 | ... << ... | The operand lhs1 is shifted by an expression rhs5 which is greater than or equal to in precision. | -| test.c:83:3:83:14 | ... << ... | The operand lhs1 is shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:85:3:85:14 | ... << ... | The operand lhs1 is shifted by an expression rhs7 which is greater than or equal to in precision. | -| test.c:87:3:87:14 | ... << ... | The operand lhs1 is shifted by an expression rhs8 which is greater than or equal to in precision. | -| test.c:89:3:89:14 | ... << ... | The operand lhs1 is shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:91:3:91:15 | ... << ... | The operand lhs1 is shifted by an expression rhs10 which is greater than or equal to in precision. | -| test.c:93:3:93:15 | ... << ... | The operand lhs1 is shifted by an expression rhs11 which is greater than or equal to in precision. | -| test.c:95:3:95:15 | ... << ... | The operand lhs1 is shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:97:3:97:15 | ... << ... | The operand lhs1 is shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:99:3:99:15 | ... << ... | The operand lhs1 is shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:134:3:134:14 | ... << ... | The operand lhs3 is shifted by an expression rhs3 which is greater than or equal to in precision. | -| test.c:138:3:138:14 | ... << ... | The operand lhs3 is shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:140:3:140:14 | ... << ... | The operand lhs3 is shifted by an expression rhs7 which is greater than or equal to in precision. | -| test.c:142:3:142:14 | ... << ... | The operand lhs3 is shifted by an expression rhs8 which is greater than or equal to in precision. | -| test.c:144:3:144:14 | ... << ... | The operand lhs3 is shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:146:3:146:15 | ... << ... | The operand lhs3 is shifted by an expression rhs10 which is greater than or equal to in precision. | -| test.c:148:3:148:15 | ... << ... | The operand lhs3 is shifted by an expression rhs11 which is greater than or equal to in precision. | -| test.c:150:3:150:15 | ... << ... | The operand lhs3 is shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:152:3:152:15 | ... << ... | The operand lhs3 is shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:154:3:154:15 | ... << ... | The operand lhs3 is shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:159:3:159:14 | ... << ... | The operand lhs4 is shifted by an expression rhs3 which is greater than or equal to in precision. | -| test.c:161:3:161:14 | ... << ... | The operand lhs4 is shifted by an expression rhs4 which is greater than or equal to in precision. | -| test.c:163:3:163:14 | ... << ... | The operand lhs4 is shifted by an expression rhs5 which is greater than or equal to in precision. | -| test.c:165:3:165:14 | ... << ... | The operand lhs4 is shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:167:3:167:14 | ... << ... | The operand lhs4 is shifted by an expression rhs7 which is greater than or equal to in precision. | -| test.c:169:3:169:14 | ... << ... | The operand lhs4 is shifted by an expression rhs8 which is greater than or equal to in precision. | -| test.c:171:3:171:14 | ... << ... | The operand lhs4 is shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:173:3:173:15 | ... << ... | The operand lhs4 is shifted by an expression rhs10 which is greater than or equal to in precision. | -| test.c:175:3:175:15 | ... << ... | The operand lhs4 is shifted by an expression rhs11 which is greater than or equal to in precision. | -| test.c:177:3:177:15 | ... << ... | The operand lhs4 is shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:179:3:179:15 | ... << ... | The operand lhs4 is shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:181:3:181:15 | ... << ... | The operand lhs4 is shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:216:3:216:14 | ... << ... | The operand lhs6 is shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:220:3:220:14 | ... << ... | The operand lhs6 is shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:224:3:224:15 | ... << ... | The operand lhs6 is shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:226:3:226:15 | ... << ... | The operand lhs6 is shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:228:3:228:15 | ... << ... | The operand lhs6 is shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:236:3:236:14 | ... << ... | The operand lhs7 is shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:238:3:238:14 | ... << ... | The operand lhs7 is shifted by an expression rhs7 which is greater than or equal to in precision. | -| test.c:240:3:240:14 | ... << ... | The operand lhs7 is shifted by an expression rhs8 which is greater than or equal to in precision. | -| test.c:242:3:242:14 | ... << ... | The operand lhs7 is shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:244:3:244:15 | ... << ... | The operand lhs7 is shifted by an expression rhs10 which is greater than or equal to in precision. | -| test.c:246:3:246:15 | ... << ... | The operand lhs7 is shifted by an expression rhs11 which is greater than or equal to in precision. | -| test.c:248:3:248:15 | ... << ... | The operand lhs7 is shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:250:3:250:15 | ... << ... | The operand lhs7 is shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:252:3:252:15 | ... << ... | The operand lhs7 is shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:292:3:292:15 | ... << ... | The operand lhs9 is shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:316:3:316:16 | ... << ... | The operand lhs10 is shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:318:3:318:16 | ... << ... | The operand lhs10 is shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:320:3:320:16 | ... << ... | The operand lhs10 is shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:358:3:358:16 | ... << ... | The operand lhs12 is shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:374:3:374:16 | ... << ... | The operand lhs13 is shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:376:3:376:16 | ... << ... | The operand lhs13 is shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:378:3:378:16 | ... << ... | The operand lhs13 is shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:1579:3:1580:10 | ... >> ... | The operand lhs0 is shifted by an expression rhs0 which is greater than or equal to in precision. | -| test.c:1583:3:1584:10 | ... >> ... | The operand lhs0 is shifted by an expression rhs3 which is greater than or equal to in precision. | -| test.c:1585:3:1586:10 | ... >> ... | The operand lhs0 is shifted by an expression rhs4 which is greater than or equal to in precision. | -| test.c:1587:3:1588:10 | ... >> ... | The operand lhs0 is shifted by an expression rhs5 which is greater than or equal to in precision. | -| test.c:1589:3:1590:10 | ... >> ... | The operand lhs0 is shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:1591:3:1592:10 | ... >> ... | The operand lhs0 is shifted by an expression rhs7 which is greater than or equal to in precision. | -| test.c:1593:3:1594:10 | ... >> ... | The operand lhs0 is shifted by an expression rhs8 which is greater than or equal to in precision. | -| test.c:1595:3:1596:10 | ... >> ... | The operand lhs0 is shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:1597:3:1597:15 | ... >> ... | The operand lhs0 is shifted by an expression rhs10 which is greater than or equal to in precision. | -| test.c:1599:3:1599:15 | ... >> ... | The operand lhs0 is shifted by an expression rhs11 which is greater than or equal to in precision. | -| test.c:1601:3:1601:15 | ... >> ... | The operand lhs0 is shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:1603:3:1603:15 | ... >> ... | The operand lhs0 is shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:1605:3:1605:15 | ... >> ... | The operand lhs0 is shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:1607:3:1608:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs0 which is greater than or equal to in precision. | -| test.c:1609:3:1610:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs1 which is greater than or equal to in precision. | -| test.c:1611:3:1612:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs2 which is greater than or equal to in precision. | -| test.c:1613:3:1614:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs3 which is greater than or equal to in precision. | -| test.c:1615:3:1616:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs4 which is greater than or equal to in precision. | -| test.c:1617:3:1618:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs5 which is greater than or equal to in precision. | -| test.c:1619:3:1620:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:1621:3:1622:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs7 which is greater than or equal to in precision. | -| test.c:1623:3:1624:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs8 which is greater than or equal to in precision. | -| test.c:1625:3:1626:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:1627:3:1627:15 | ... >> ... | The operand lhs1 is shifted by an expression rhs10 which is greater than or equal to in precision. | -| test.c:1629:3:1629:15 | ... >> ... | The operand lhs1 is shifted by an expression rhs11 which is greater than or equal to in precision. | -| test.c:1631:3:1631:15 | ... >> ... | The operand lhs1 is shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:1633:3:1633:15 | ... >> ... | The operand lhs1 is shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:1635:3:1635:15 | ... >> ... | The operand lhs1 is shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:1670:3:1671:10 | ... >> ... | The operand lhs3 is shifted by an expression rhs3 which is greater than or equal to in precision. | -| test.c:1674:3:1675:10 | ... >> ... | The operand lhs3 is shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:1676:3:1677:10 | ... >> ... | The operand lhs3 is shifted by an expression rhs7 which is greater than or equal to in precision. | -| test.c:1678:3:1679:10 | ... >> ... | The operand lhs3 is shifted by an expression rhs8 which is greater than or equal to in precision. | -| test.c:1680:3:1681:10 | ... >> ... | The operand lhs3 is shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:1682:3:1682:15 | ... >> ... | The operand lhs3 is shifted by an expression rhs10 which is greater than or equal to in precision. | -| test.c:1684:3:1684:15 | ... >> ... | The operand lhs3 is shifted by an expression rhs11 which is greater than or equal to in precision. | -| test.c:1686:3:1686:15 | ... >> ... | The operand lhs3 is shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:1688:3:1688:15 | ... >> ... | The operand lhs3 is shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:1690:3:1690:15 | ... >> ... | The operand lhs3 is shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:1695:3:1696:10 | ... >> ... | The operand lhs4 is shifted by an expression rhs3 which is greater than or equal to in precision. | -| test.c:1697:3:1698:10 | ... >> ... | The operand lhs4 is shifted by an expression rhs4 which is greater than or equal to in precision. | -| test.c:1699:3:1700:10 | ... >> ... | The operand lhs4 is shifted by an expression rhs5 which is greater than or equal to in precision. | -| test.c:1701:3:1702:10 | ... >> ... | The operand lhs4 is shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:1703:3:1704:10 | ... >> ... | The operand lhs4 is shifted by an expression rhs7 which is greater than or equal to in precision. | -| test.c:1705:3:1706:10 | ... >> ... | The operand lhs4 is shifted by an expression rhs8 which is greater than or equal to in precision. | -| test.c:1707:3:1708:10 | ... >> ... | The operand lhs4 is shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:1709:3:1709:15 | ... >> ... | The operand lhs4 is shifted by an expression rhs10 which is greater than or equal to in precision. | -| test.c:1711:3:1711:15 | ... >> ... | The operand lhs4 is shifted by an expression rhs11 which is greater than or equal to in precision. | -| test.c:1713:3:1713:15 | ... >> ... | The operand lhs4 is shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:1715:3:1715:15 | ... >> ... | The operand lhs4 is shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:1717:3:1717:15 | ... >> ... | The operand lhs4 is shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:1752:3:1753:10 | ... >> ... | The operand lhs6 is shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:1756:3:1757:10 | ... >> ... | The operand lhs6 is shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:1760:3:1760:15 | ... >> ... | The operand lhs6 is shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:1762:3:1762:15 | ... >> ... | The operand lhs6 is shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:1764:3:1764:15 | ... >> ... | The operand lhs6 is shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:1772:3:1773:10 | ... >> ... | The operand lhs7 is shifted by an expression rhs6 which is greater than or equal to in precision. | -| test.c:1774:3:1775:10 | ... >> ... | The operand lhs7 is shifted by an expression rhs7 which is greater than or equal to in precision. | -| test.c:1776:3:1777:10 | ... >> ... | The operand lhs7 is shifted by an expression rhs8 which is greater than or equal to in precision. | -| test.c:1778:3:1779:10 | ... >> ... | The operand lhs7 is shifted by an expression rhs9 which is greater than or equal to in precision. | -| test.c:1780:3:1780:15 | ... >> ... | The operand lhs7 is shifted by an expression rhs10 which is greater than or equal to in precision. | -| test.c:1782:3:1782:15 | ... >> ... | The operand lhs7 is shifted by an expression rhs11 which is greater than or equal to in precision. | -| test.c:1784:3:1784:15 | ... >> ... | The operand lhs7 is shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:1786:3:1786:15 | ... >> ... | The operand lhs7 is shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:1788:3:1788:15 | ... >> ... | The operand lhs7 is shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:1828:3:1828:15 | ... >> ... | The operand lhs9 is shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:1852:3:1852:16 | ... >> ... | The operand lhs10 is shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:1854:3:1854:16 | ... >> ... | The operand lhs10 is shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:1856:3:1856:16 | ... >> ... | The operand lhs10 is shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:1894:3:1894:16 | ... >> ... | The operand lhs12 is shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:1910:3:1910:16 | ... >> ... | The operand lhs13 is shifted by an expression rhs12 which is greater than or equal to in precision. | -| test.c:1912:3:1912:16 | ... >> ... | The operand lhs13 is shifted by an expression rhs13 which is greater than or equal to in precision. | -| test.c:1914:3:1914:16 | ... >> ... | The operand lhs13 is shifted by an expression rhs14 which is greater than or equal to in precision. | -| test.c:3115:3:3115:12 | ... << ... | The operand lhs0 is shifted by a negative expression - .... | -| test.c:3116:3:3116:12 | ... << ... | The operand lhs1 is shifted by a negative expression - .... | -| test.c:3117:3:3117:12 | ... << ... | The operand lhs2 is shifted by a negative expression - .... | -| test.c:3118:3:3118:12 | ... << ... | The operand lhs3 is shifted by a negative expression - .... | -| test.c:3119:3:3119:12 | ... << ... | The operand lhs4 is shifted by a negative expression - .... | -| test.c:3120:3:3120:12 | ... << ... | The operand lhs5 is shifted by a negative expression - .... | -| test.c:3121:3:3121:12 | ... << ... | The operand lhs6 is shifted by a negative expression - .... | -| test.c:3122:3:3122:12 | ... << ... | The operand lhs7 is shifted by a negative expression - .... | -| test.c:3123:3:3123:12 | ... << ... | The operand lhs8 is shifted by a negative expression - .... | -| test.c:3124:3:3124:12 | ... << ... | The operand lhs9 is shifted by a negative expression - .... | -| test.c:3125:3:3125:13 | ... << ... | The operand lhs10 is shifted by a negative expression - .... | -| test.c:3126:3:3126:13 | ... << ... | The operand lhs11 is shifted by a negative expression - .... | -| test.c:3127:3:3127:13 | ... << ... | The operand lhs12 is shifted by a negative expression - .... | -| test.c:3128:3:3128:13 | ... << ... | The operand lhs13 is shifted by a negative expression - .... | -| test.c:3129:3:3129:13 | ... << ... | The operand lhs14 is shifted by a negative expression - .... | +| test.c:43:3:43:14 | ... << ... | The operand lhs0 is shifted by an expression rhs0 whose upper bound (8) is greater than or equal to the precision. | +| test.c:47:3:47:14 | ... << ... | The operand lhs0 is shifted by an expression rhs3 whose upper bound (16) is greater than or equal to the precision. | +| test.c:49:3:49:14 | ... << ... | The operand lhs0 is shifted by an expression rhs4 whose upper bound (15) is greater than or equal to the precision. | +| test.c:51:3:51:14 | ... << ... | The operand lhs0 is shifted by an expression rhs5 whose upper bound (15) is greater than or equal to the precision. | +| test.c:53:3:53:14 | ... << ... | The operand lhs0 is shifted by an expression rhs6 whose upper bound (32) is greater than or equal to the precision. | +| test.c:55:3:55:14 | ... << ... | The operand lhs0 is shifted by an expression rhs7 whose upper bound (31) is greater than or equal to the precision. | +| test.c:57:3:57:14 | ... << ... | The operand lhs0 is shifted by an expression rhs8 whose upper bound (31) is greater than or equal to the precision. | +| test.c:59:3:59:14 | ... << ... | The operand lhs0 is shifted by an expression rhs9 whose upper bound (32) is greater than or equal to the precision. | +| test.c:61:3:61:15 | ... << ... | The operand lhs0 is shifted by an expression rhs10 whose upper bound (31) is greater than or equal to the precision. | +| test.c:63:3:63:15 | ... << ... | The operand lhs0 is shifted by an expression rhs11 whose upper bound (31) is greater than or equal to the precision. | +| test.c:65:3:65:15 | ... << ... | The operand lhs0 is shifted by an expression rhs12 whose upper bound (64) is greater than or equal to the precision. | +| test.c:67:3:67:15 | ... << ... | The operand lhs0 is shifted by an expression rhs13 whose upper bound (63) is greater than or equal to the precision. | +| test.c:69:3:69:15 | ... << ... | The operand lhs0 is shifted by an expression rhs14 whose upper bound (63) is greater than or equal to the precision. | +| test.c:71:3:71:14 | ... << ... | The operand lhs1 is shifted by an expression rhs0 whose upper bound (8) is greater than or equal to the precision. | +| test.c:73:3:73:14 | ... << ... | The operand lhs1 is shifted by an expression rhs1 whose upper bound (7) is greater than or equal to the precision. | +| test.c:75:3:75:14 | ... << ... | The operand lhs1 is shifted by an expression rhs2 whose upper bound (7) is greater than or equal to the precision. | +| test.c:77:3:77:14 | ... << ... | The operand lhs1 is shifted by an expression rhs3 whose upper bound (16) is greater than or equal to the precision. | +| test.c:79:3:79:14 | ... << ... | The operand lhs1 is shifted by an expression rhs4 whose upper bound (15) is greater than or equal to the precision. | +| test.c:81:3:81:14 | ... << ... | The operand lhs1 is shifted by an expression rhs5 whose upper bound (15) is greater than or equal to the precision. | +| test.c:83:3:83:14 | ... << ... | The operand lhs1 is shifted by an expression rhs6 whose upper bound (32) is greater than or equal to the precision. | +| test.c:85:3:85:14 | ... << ... | The operand lhs1 is shifted by an expression rhs7 whose upper bound (31) is greater than or equal to the precision. | +| test.c:87:3:87:14 | ... << ... | The operand lhs1 is shifted by an expression rhs8 whose upper bound (31) is greater than or equal to the precision. | +| test.c:89:3:89:14 | ... << ... | The operand lhs1 is shifted by an expression rhs9 whose upper bound (32) is greater than or equal to the precision. | +| test.c:91:3:91:15 | ... << ... | The operand lhs1 is shifted by an expression rhs10 whose upper bound (31) is greater than or equal to the precision. | +| test.c:93:3:93:15 | ... << ... | The operand lhs1 is shifted by an expression rhs11 whose upper bound (31) is greater than or equal to the precision. | +| test.c:95:3:95:15 | ... << ... | The operand lhs1 is shifted by an expression rhs12 whose upper bound (64) is greater than or equal to the precision. | +| test.c:97:3:97:15 | ... << ... | The operand lhs1 is shifted by an expression rhs13 whose upper bound (63) is greater than or equal to the precision. | +| test.c:99:3:99:15 | ... << ... | The operand lhs1 is shifted by an expression rhs14 whose upper bound (63) is greater than or equal to the precision. | +| test.c:134:3:134:14 | ... << ... | The operand lhs3 is shifted by an expression rhs3 whose upper bound (16) is greater than or equal to the precision. | +| test.c:138:3:138:14 | ... << ... | The operand lhs3 is shifted by an expression rhs6 whose upper bound (32) is greater than or equal to the precision. | +| test.c:140:3:140:14 | ... << ... | The operand lhs3 is shifted by an expression rhs7 whose upper bound (31) is greater than or equal to the precision. | +| test.c:142:3:142:14 | ... << ... | The operand lhs3 is shifted by an expression rhs8 whose upper bound (31) is greater than or equal to the precision. | +| test.c:144:3:144:14 | ... << ... | The operand lhs3 is shifted by an expression rhs9 whose upper bound (32) is greater than or equal to the precision. | +| test.c:146:3:146:15 | ... << ... | The operand lhs3 is shifted by an expression rhs10 whose upper bound (31) is greater than or equal to the precision. | +| test.c:148:3:148:15 | ... << ... | The operand lhs3 is shifted by an expression rhs11 whose upper bound (31) is greater than or equal to the precision. | +| test.c:150:3:150:15 | ... << ... | The operand lhs3 is shifted by an expression rhs12 whose upper bound (64) is greater than or equal to the precision. | +| test.c:152:3:152:15 | ... << ... | The operand lhs3 is shifted by an expression rhs13 whose upper bound (63) is greater than or equal to the precision. | +| test.c:154:3:154:15 | ... << ... | The operand lhs3 is shifted by an expression rhs14 whose upper bound (63) is greater than or equal to the precision. | +| test.c:159:3:159:14 | ... << ... | The operand lhs4 is shifted by an expression rhs3 whose upper bound (16) is greater than or equal to the precision. | +| test.c:161:3:161:14 | ... << ... | The operand lhs4 is shifted by an expression rhs4 whose upper bound (15) is greater than or equal to the precision. | +| test.c:163:3:163:14 | ... << ... | The operand lhs4 is shifted by an expression rhs5 whose upper bound (15) is greater than or equal to the precision. | +| test.c:165:3:165:14 | ... << ... | The operand lhs4 is shifted by an expression rhs6 whose upper bound (32) is greater than or equal to the precision. | +| test.c:167:3:167:14 | ... << ... | The operand lhs4 is shifted by an expression rhs7 whose upper bound (31) is greater than or equal to the precision. | +| test.c:169:3:169:14 | ... << ... | The operand lhs4 is shifted by an expression rhs8 whose upper bound (31) is greater than or equal to the precision. | +| test.c:171:3:171:14 | ... << ... | The operand lhs4 is shifted by an expression rhs9 whose upper bound (32) is greater than or equal to the precision. | +| test.c:173:3:173:15 | ... << ... | The operand lhs4 is shifted by an expression rhs10 whose upper bound (31) is greater than or equal to the precision. | +| test.c:175:3:175:15 | ... << ... | The operand lhs4 is shifted by an expression rhs11 whose upper bound (31) is greater than or equal to the precision. | +| test.c:177:3:177:15 | ... << ... | The operand lhs4 is shifted by an expression rhs12 whose upper bound (64) is greater than or equal to the precision. | +| test.c:179:3:179:15 | ... << ... | The operand lhs4 is shifted by an expression rhs13 whose upper bound (63) is greater than or equal to the precision. | +| test.c:181:3:181:15 | ... << ... | The operand lhs4 is shifted by an expression rhs14 whose upper bound (63) is greater than or equal to the precision. | +| test.c:216:3:216:14 | ... << ... | The operand lhs6 is shifted by an expression rhs6 whose upper bound (32) is greater than or equal to the precision. | +| test.c:220:3:220:14 | ... << ... | The operand lhs6 is shifted by an expression rhs9 whose upper bound (32) is greater than or equal to the precision. | +| test.c:224:3:224:15 | ... << ... | The operand lhs6 is shifted by an expression rhs12 whose upper bound (64) is greater than or equal to the precision. | +| test.c:226:3:226:15 | ... << ... | The operand lhs6 is shifted by an expression rhs13 whose upper bound (63) is greater than or equal to the precision. | +| test.c:228:3:228:15 | ... << ... | The operand lhs6 is shifted by an expression rhs14 whose upper bound (63) is greater than or equal to the precision. | +| test.c:236:3:236:14 | ... << ... | The operand lhs7 is shifted by an expression rhs6 whose upper bound (32) is greater than or equal to the precision. | +| test.c:238:3:238:14 | ... << ... | The operand lhs7 is shifted by an expression rhs7 whose upper bound (31) is greater than or equal to the precision. | +| test.c:240:3:240:14 | ... << ... | The operand lhs7 is shifted by an expression rhs8 whose upper bound (31) is greater than or equal to the precision. | +| test.c:242:3:242:14 | ... << ... | The operand lhs7 is shifted by an expression rhs9 whose upper bound (32) is greater than or equal to the precision. | +| test.c:244:3:244:15 | ... << ... | The operand lhs7 is shifted by an expression rhs10 whose upper bound (31) is greater than or equal to the precision. | +| test.c:246:3:246:15 | ... << ... | The operand lhs7 is shifted by an expression rhs11 whose upper bound (31) is greater than or equal to the precision. | +| test.c:248:3:248:15 | ... << ... | The operand lhs7 is shifted by an expression rhs12 whose upper bound (64) is greater than or equal to the precision. | +| test.c:250:3:250:15 | ... << ... | The operand lhs7 is shifted by an expression rhs13 whose upper bound (63) is greater than or equal to the precision. | +| test.c:252:3:252:15 | ... << ... | The operand lhs7 is shifted by an expression rhs14 whose upper bound (63) is greater than or equal to the precision. | +| test.c:292:3:292:15 | ... << ... | The operand lhs9 is shifted by an expression rhs12 whose upper bound (64) is greater than or equal to the precision. | +| test.c:316:3:316:16 | ... << ... | The operand lhs10 is shifted by an expression rhs12 whose upper bound (64) is greater than or equal to the precision. | +| test.c:318:3:318:16 | ... << ... | The operand lhs10 is shifted by an expression rhs13 whose upper bound (63) is greater than or equal to the precision. | +| test.c:320:3:320:16 | ... << ... | The operand lhs10 is shifted by an expression rhs14 whose upper bound (63) is greater than or equal to the precision. | +| test.c:358:3:358:16 | ... << ... | The operand lhs12 is shifted by an expression rhs12 whose upper bound (64) is greater than or equal to the precision. | +| test.c:374:3:374:16 | ... << ... | The operand lhs13 is shifted by an expression rhs12 whose upper bound (64) is greater than or equal to the precision. | +| test.c:376:3:376:16 | ... << ... | The operand lhs13 is shifted by an expression rhs13 whose upper bound (63) is greater than or equal to the precision. | +| test.c:378:3:378:16 | ... << ... | The operand lhs13 is shifted by an expression rhs14 whose upper bound (63) is greater than or equal to the precision. | +| test.c:1579:3:1580:10 | ... >> ... | The operand lhs0 is shifted by an expression rhs0 whose upper bound (8) is greater than or equal to the precision. | +| test.c:1583:3:1584:10 | ... >> ... | The operand lhs0 is shifted by an expression rhs3 whose upper bound (16) is greater than or equal to the precision. | +| test.c:1585:3:1586:10 | ... >> ... | The operand lhs0 is shifted by an expression rhs4 whose upper bound (15) is greater than or equal to the precision. | +| test.c:1587:3:1588:10 | ... >> ... | The operand lhs0 is shifted by an expression rhs5 whose upper bound (15) is greater than or equal to the precision. | +| test.c:1589:3:1590:10 | ... >> ... | The operand lhs0 is shifted by an expression rhs6 whose upper bound (32) is greater than or equal to the precision. | +| test.c:1591:3:1592:10 | ... >> ... | The operand lhs0 is shifted by an expression rhs7 whose upper bound (31) is greater than or equal to the precision. | +| test.c:1593:3:1594:10 | ... >> ... | The operand lhs0 is shifted by an expression rhs8 whose upper bound (31) is greater than or equal to the precision. | +| test.c:1595:3:1596:10 | ... >> ... | The operand lhs0 is shifted by an expression rhs9 whose upper bound (32) is greater than or equal to the precision. | +| test.c:1597:3:1597:15 | ... >> ... | The operand lhs0 is shifted by an expression rhs10 whose upper bound (31) is greater than or equal to the precision. | +| test.c:1599:3:1599:15 | ... >> ... | The operand lhs0 is shifted by an expression rhs11 whose upper bound (31) is greater than or equal to the precision. | +| test.c:1601:3:1601:15 | ... >> ... | The operand lhs0 is shifted by an expression rhs12 whose upper bound (64) is greater than or equal to the precision. | +| test.c:1603:3:1603:15 | ... >> ... | The operand lhs0 is shifted by an expression rhs13 whose upper bound (63) is greater than or equal to the precision. | +| test.c:1605:3:1605:15 | ... >> ... | The operand lhs0 is shifted by an expression rhs14 whose upper bound (63) is greater than or equal to the precision. | +| test.c:1607:3:1608:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs0 whose upper bound (8) is greater than or equal to the precision. | +| test.c:1609:3:1610:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs1 whose upper bound (7) is greater than or equal to the precision. | +| test.c:1611:3:1612:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs2 whose upper bound (7) is greater than or equal to the precision. | +| test.c:1613:3:1614:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs3 whose upper bound (16) is greater than or equal to the precision. | +| test.c:1615:3:1616:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs4 whose upper bound (15) is greater than or equal to the precision. | +| test.c:1617:3:1618:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs5 whose upper bound (15) is greater than or equal to the precision. | +| test.c:1619:3:1620:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs6 whose upper bound (32) is greater than or equal to the precision. | +| test.c:1621:3:1622:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs7 whose upper bound (31) is greater than or equal to the precision. | +| test.c:1623:3:1624:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs8 whose upper bound (31) is greater than or equal to the precision. | +| test.c:1625:3:1626:10 | ... >> ... | The operand lhs1 is shifted by an expression rhs9 whose upper bound (32) is greater than or equal to the precision. | +| test.c:1627:3:1627:15 | ... >> ... | The operand lhs1 is shifted by an expression rhs10 whose upper bound (31) is greater than or equal to the precision. | +| test.c:1629:3:1629:15 | ... >> ... | The operand lhs1 is shifted by an expression rhs11 whose upper bound (31) is greater than or equal to the precision. | +| test.c:1631:3:1631:15 | ... >> ... | The operand lhs1 is shifted by an expression rhs12 whose upper bound (64) is greater than or equal to the precision. | +| test.c:1633:3:1633:15 | ... >> ... | The operand lhs1 is shifted by an expression rhs13 whose upper bound (63) is greater than or equal to the precision. | +| test.c:1635:3:1635:15 | ... >> ... | The operand lhs1 is shifted by an expression rhs14 whose upper bound (63) is greater than or equal to the precision. | +| test.c:1670:3:1671:10 | ... >> ... | The operand lhs3 is shifted by an expression rhs3 whose upper bound (16) is greater than or equal to the precision. | +| test.c:1674:3:1675:10 | ... >> ... | The operand lhs3 is shifted by an expression rhs6 whose upper bound (32) is greater than or equal to the precision. | +| test.c:1676:3:1677:10 | ... >> ... | The operand lhs3 is shifted by an expression rhs7 whose upper bound (31) is greater than or equal to the precision. | +| test.c:1678:3:1679:10 | ... >> ... | The operand lhs3 is shifted by an expression rhs8 whose upper bound (31) is greater than or equal to the precision. | +| test.c:1680:3:1681:10 | ... >> ... | The operand lhs3 is shifted by an expression rhs9 whose upper bound (32) is greater than or equal to the precision. | +| test.c:1682:3:1682:15 | ... >> ... | The operand lhs3 is shifted by an expression rhs10 whose upper bound (31) is greater than or equal to the precision. | +| test.c:1684:3:1684:15 | ... >> ... | The operand lhs3 is shifted by an expression rhs11 whose upper bound (31) is greater than or equal to the precision. | +| test.c:1686:3:1686:15 | ... >> ... | The operand lhs3 is shifted by an expression rhs12 whose upper bound (64) is greater than or equal to the precision. | +| test.c:1688:3:1688:15 | ... >> ... | The operand lhs3 is shifted by an expression rhs13 whose upper bound (63) is greater than or equal to the precision. | +| test.c:1690:3:1690:15 | ... >> ... | The operand lhs3 is shifted by an expression rhs14 whose upper bound (63) is greater than or equal to the precision. | +| test.c:1695:3:1696:10 | ... >> ... | The operand lhs4 is shifted by an expression rhs3 whose upper bound (16) is greater than or equal to the precision. | +| test.c:1697:3:1698:10 | ... >> ... | The operand lhs4 is shifted by an expression rhs4 whose upper bound (15) is greater than or equal to the precision. | +| test.c:1699:3:1700:10 | ... >> ... | The operand lhs4 is shifted by an expression rhs5 whose upper bound (15) is greater than or equal to the precision. | +| test.c:1701:3:1702:10 | ... >> ... | The operand lhs4 is shifted by an expression rhs6 whose upper bound (32) is greater than or equal to the precision. | +| test.c:1703:3:1704:10 | ... >> ... | The operand lhs4 is shifted by an expression rhs7 whose upper bound (31) is greater than or equal to the precision. | +| test.c:1705:3:1706:10 | ... >> ... | The operand lhs4 is shifted by an expression rhs8 whose upper bound (31) is greater than or equal to the precision. | +| test.c:1707:3:1708:10 | ... >> ... | The operand lhs4 is shifted by an expression rhs9 whose upper bound (32) is greater than or equal to the precision. | +| test.c:1709:3:1709:15 | ... >> ... | The operand lhs4 is shifted by an expression rhs10 whose upper bound (31) is greater than or equal to the precision. | +| test.c:1711:3:1711:15 | ... >> ... | The operand lhs4 is shifted by an expression rhs11 whose upper bound (31) is greater than or equal to the precision. | +| test.c:1713:3:1713:15 | ... >> ... | The operand lhs4 is shifted by an expression rhs12 whose upper bound (64) is greater than or equal to the precision. | +| test.c:1715:3:1715:15 | ... >> ... | The operand lhs4 is shifted by an expression rhs13 whose upper bound (63) is greater than or equal to the precision. | +| test.c:1717:3:1717:15 | ... >> ... | The operand lhs4 is shifted by an expression rhs14 whose upper bound (63) is greater than or equal to the precision. | +| test.c:1752:3:1753:10 | ... >> ... | The operand lhs6 is shifted by an expression rhs6 whose upper bound (32) is greater than or equal to the precision. | +| test.c:1756:3:1757:10 | ... >> ... | The operand lhs6 is shifted by an expression rhs9 whose upper bound (32) is greater than or equal to the precision. | +| test.c:1760:3:1760:15 | ... >> ... | The operand lhs6 is shifted by an expression rhs12 whose upper bound (64) is greater than or equal to the precision. | +| test.c:1762:3:1762:15 | ... >> ... | The operand lhs6 is shifted by an expression rhs13 whose upper bound (63) is greater than or equal to the precision. | +| test.c:1764:3:1764:15 | ... >> ... | The operand lhs6 is shifted by an expression rhs14 whose upper bound (63) is greater than or equal to the precision. | +| test.c:1772:3:1773:10 | ... >> ... | The operand lhs7 is shifted by an expression rhs6 whose upper bound (32) is greater than or equal to the precision. | +| test.c:1774:3:1775:10 | ... >> ... | The operand lhs7 is shifted by an expression rhs7 whose upper bound (31) is greater than or equal to the precision. | +| test.c:1776:3:1777:10 | ... >> ... | The operand lhs7 is shifted by an expression rhs8 whose upper bound (31) is greater than or equal to the precision. | +| test.c:1778:3:1779:10 | ... >> ... | The operand lhs7 is shifted by an expression rhs9 whose upper bound (32) is greater than or equal to the precision. | +| test.c:1780:3:1780:15 | ... >> ... | The operand lhs7 is shifted by an expression rhs10 whose upper bound (31) is greater than or equal to the precision. | +| test.c:1782:3:1782:15 | ... >> ... | The operand lhs7 is shifted by an expression rhs11 whose upper bound (31) is greater than or equal to the precision. | +| test.c:1784:3:1784:15 | ... >> ... | The operand lhs7 is shifted by an expression rhs12 whose upper bound (64) is greater than or equal to the precision. | +| test.c:1786:3:1786:15 | ... >> ... | The operand lhs7 is shifted by an expression rhs13 whose upper bound (63) is greater than or equal to the precision. | +| test.c:1788:3:1788:15 | ... >> ... | The operand lhs7 is shifted by an expression rhs14 whose upper bound (63) is greater than or equal to the precision. | +| test.c:1828:3:1828:15 | ... >> ... | The operand lhs9 is shifted by an expression rhs12 whose upper bound (64) is greater than or equal to the precision. | +| test.c:1852:3:1852:16 | ... >> ... | The operand lhs10 is shifted by an expression rhs12 whose upper bound (64) is greater than or equal to the precision. | +| test.c:1854:3:1854:16 | ... >> ... | The operand lhs10 is shifted by an expression rhs13 whose upper bound (63) is greater than or equal to the precision. | +| test.c:1856:3:1856:16 | ... >> ... | The operand lhs10 is shifted by an expression rhs14 whose upper bound (63) is greater than or equal to the precision. | +| test.c:1894:3:1894:16 | ... >> ... | The operand lhs12 is shifted by an expression rhs12 whose upper bound (64) is greater than or equal to the precision. | +| test.c:1910:3:1910:16 | ... >> ... | The operand lhs13 is shifted by an expression rhs12 whose upper bound (64) is greater than or equal to the precision. | +| test.c:1912:3:1912:16 | ... >> ... | The operand lhs13 is shifted by an expression rhs13 whose upper bound (63) is greater than or equal to the precision. | +| test.c:1914:3:1914:16 | ... >> ... | The operand lhs13 is shifted by an expression rhs14 whose upper bound (63) is greater than or equal to the precision. | +| test.c:3115:3:3115:12 | ... << ... | The operand lhs0 is shifted by an expression - ... which may be negative. | +| test.c:3116:3:3116:12 | ... << ... | The operand lhs1 is shifted by an expression - ... which may be negative. | +| test.c:3117:3:3117:12 | ... << ... | The operand lhs2 is shifted by an expression - ... which may be negative. | +| test.c:3118:3:3118:12 | ... << ... | The operand lhs3 is shifted by an expression - ... which may be negative. | +| test.c:3119:3:3119:12 | ... << ... | The operand lhs4 is shifted by an expression - ... which may be negative. | +| test.c:3120:3:3120:12 | ... << ... | The operand lhs5 is shifted by an expression - ... which may be negative. | +| test.c:3121:3:3121:12 | ... << ... | The operand lhs6 is shifted by an expression - ... which may be negative. | +| test.c:3122:3:3122:12 | ... << ... | The operand lhs7 is shifted by an expression - ... which may be negative. | +| test.c:3123:3:3123:12 | ... << ... | The operand lhs8 is shifted by an expression - ... which may be negative. | +| test.c:3124:3:3124:12 | ... << ... | The operand lhs9 is shifted by an expression - ... which may be negative. | +| test.c:3125:3:3125:13 | ... << ... | The operand lhs10 is shifted by an expression - ... which may be negative. | +| test.c:3126:3:3126:13 | ... << ... | The operand lhs11 is shifted by an expression - ... which may be negative. | +| test.c:3127:3:3127:13 | ... << ... | The operand lhs12 is shifted by an expression - ... which may be negative. | +| test.c:3128:3:3128:13 | ... << ... | The operand lhs13 is shifted by an expression - ... which may be negative. | +| test.c:3129:3:3129:13 | ... << ... | The operand lhs14 is shifted by an expression - ... which may be negative. | From 9fc57bd2a1e4693c146a83882e313572cfd20bc7 Mon Sep 17 00:00:00 2001 From: Luke Cartey Date: Wed, 29 Mar 2023 10:59:26 +0100 Subject: [PATCH 52/53] DIR-4-6: Only flag aliases of built-in numeric types. --- .../DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql b/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql index 6c8d283786..c22e369d77 100644 --- a/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql +++ b/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql @@ -49,8 +49,9 @@ predicate forbiddenTypedef(CTypedefType typedef, string message) { typedef.getName().regexpCapture("u?(int|float)(4|8|16|32|64|128)_t", 2).toInt() and message = "The typedef type " + typedef.getName() + " does not have its indicated size." ) else ( - /* Otherwise, the aliased type itself should have an explicit size in its name. */ - not typedef.getBaseType().getName().regexpMatch("u?(int|float)(4|8|16|32|64|128)_t") and + /* Otherwise, if the type is an alias of a built in numeric type it should have an explicit size in its name. */ + typedef.getUnspecifiedType() instanceof BuiltInNumericType and + not typedef.getBaseType+().getName().regexpMatch("u?(int|float)(4|8|16|32|64|128)_t") and message = "The type " + typedef.getName() + " is not an alias to a fixed-width numeric type." ) ) From 93b939129b81608fab22a1f2cec67feb694677cf Mon Sep 17 00:00:00 2001 From: Luke Cartey Date: Wed, 29 Mar 2023 11:28:16 +0100 Subject: [PATCH 53/53] DIR-4-6: typedefs should be to numeric types Recursively identify typedefs that are to the built in numeric types, but do not use the size alias. --- .../PlainNumericalTypeUsedOverExplicitTypedef.ql | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql b/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql index c22e369d77..c3ea6dfdbd 100644 --- a/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql +++ b/c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql @@ -37,7 +37,6 @@ predicate forbiddenBuiltinNumericUsedInDecl(Variable var, string message) { message = "The type " + var.getType() + " is not a fixed-width numeric type." } -// TODO: add some inline comments predicate forbiddenTypedef(CTypedefType typedef, string message) { /* If the typedef's name contains an explicit size */ ( @@ -49,9 +48,15 @@ predicate forbiddenTypedef(CTypedefType typedef, string message) { typedef.getName().regexpCapture("u?(int|float)(4|8|16|32|64|128)_t", 2).toInt() and message = "The typedef type " + typedef.getName() + " does not have its indicated size." ) else ( - /* Otherwise, if the type is an alias of a built in numeric type it should have an explicit size in its name. */ - typedef.getUnspecifiedType() instanceof BuiltInNumericType and - not typedef.getBaseType+().getName().regexpMatch("u?(int|float)(4|8|16|32|64|128)_t") and + ( + // type def is to a built in numeric type + typedef.getBaseType() instanceof BuiltInNumericType and + // but does not include the size in the name + not typedef.getName().regexpMatch("u?(int|float)(4|8|16|32|64|128)_t") + or + // this is a typedef to a forbidden type def + forbiddenTypedef(typedef.getBaseType(), _) + ) and message = "The type " + typedef.getName() + " is not an alias to a fixed-width numeric type." ) )