Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,11 @@ void test_sub_postcheck(unsigned int i1, unsigned int i2) {
if (i1 > i2) {
// handle error
}
}

void test_mod_rem(unsigned int i1, unsigned int i2) {
i1 / i2; // COMPLIANT - exception 2
i1 /= i2; // COMPLIANT - exception 2
i1 % i2; // COMPLIANT - exception 2
i1 %= i2; // COMPLIANT - exception 2
}
Comment thread
Copilot marked this conversation as resolved.
4 changes: 4 additions & 0 deletions change_notes/2026-06-18-fix-fp-misra-c++-8-20-1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- `INT30-C` - `UnsignedIntegerOperationsWrapAround.ql`:
- Fixed false positives for `/=` and `%=` assignments.
- `RULE-8-20-1` - `UnsignedOperationWithConstantOperandsWraps.ql`:
- Fixed false positives for `/=` and `%=` assignments.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ query predicate problems(InterestingOverflowingOperation op, string message) {
// Permitted by exception 3
not op instanceof LShiftExpr and
// Permitted by exception 2 - zero case is handled in separate query
not op instanceof DivExpr and
not op instanceof RemExpr and
not op instanceof DivOrRemOperation and
message =
"Operation " + op.getOperator() + " of type " + op.getType().getUnderlyingType() + " may wrap."
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,11 @@ void test_sub_postcheck(unsigned int i1, unsigned int i2) {
if (i1 > i2) {
// handle error
}
}

void test_mod_rem(unsigned int i1, unsigned int i2) {
i1 / i2; // COMPLIANT - exception 2
i1 /= i2; // COMPLIANT - exception 2
i1 % i2; // COMPLIANT - exception 2
i1 %= i2; // COMPLIANT - exception 2
}
Comment thread
Copilot marked this conversation as resolved.
Loading