We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8b9f677 commit 4a98576Copy full SHA for 4a98576
cpp/autosar/src/rules/A4-7-1/IntegerExpressionLeadToDataLoss.ql
@@ -30,5 +30,7 @@ where
30
not e instanceof MulExpr and
31
// Not covered by this query - overflow/underflow in division is rare
32
not e instanceof DivExpr and
33
- not e instanceof RemExpr
+ not e instanceof AssignDivExpr and
34
+ not e instanceof RemExpr and
35
+ not e instanceof AssignRemExpr
36
select e, "Binary expression ..." + e.getOperator() + "... may overflow."
cpp/autosar/test/rules/A4-7-1/test.cpp
@@ -62,4 +62,8 @@ void test_loop_bound_bad(unsigned int n) {
62
i++) { // NON_COMPLIANT - crement will overflow before loop bound is
63
// reached
64
}
65
+}
66
+
67
+void test_assign_div(int i) { // COMPLIANT
68
+ i /= 2;
69
0 commit comments