There was a problem hiding this comment.
This PR aims to reduce false positives for unsigned division/remainder compound assignments (/= and %=) in the shared “unsigned operation with constant operands wraps” logic, which is reused by INT30-C and RULE-8-20-1.
Changes:
Review checklist items uncertain / not verified in this automated review:
| cpp/common/src/codingstandards/cpp/rules/unsignedoperationwithconstantoperandswraps/UnsignedOperationWithConstantOperandsWraps.qll | Broadens the exception-2 exclusion to cover division/remainder compound assignments via DivOrRemOperation. |
| cpp/common/test/rules/unsignedoperationwithconstantoperandswraps/test.cpp | Adds /, /=, %, %= COMPLIANT tests (currently introduced in a way that breaks compilation; see PR comments). |
| c/common/test/rules/unsignedoperationwithconstantoperandswraps/test.c | Mirrors the C++ test additions (currently introduced in a way that breaks compilation; see PR comments). |
| change_notes/2026-06-18-fix-fp-misra-c++-8-20-1.md | Documents the FP fix for INT30-C and RULE-8-20-1. |
Sorry, something went wrong.
Description
This pull request addresses false positives in the detection of unsigned integer operations that may wrap around, specifically for division and remainder assignments (/= and %=), and updates relevant tests and documentation. The main changes include refining the logic in the query to group division and remainder operations, updating test cases to reflect compliant usage, and documenting the fixes.
Change request type
Rules with added or modified queries
Release change checklist
A change note (development_handbook.md#change-notes) is required for any pull request which modifies:
If you are only adding new rule queries, a change note is not required.
Author: Is a change note required?
🚨🚨🚨
Reviewer: Confirm that format of shared queries (not the .qll file, the
.ql file that imports it) is valid by running them within VS Code.
Reviewer: Confirm that either a change note is not required or the change note is required and has been added.
Query development review checklist
For PRs that add new queries or modify existing queries, the following checklist should be completed by both the author and reviewer:
Author
As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
Reviewer
As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.