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
@@ -1,3 +1,4 @@
| test.c:9:7:9:12 | ... = ... | Use of an assignment operator's result. |
| test.c:13:11:13:16 | ... = ... | Use of an assignment operator's result. |
| test.c:15:8:15:13 | ... = ... | Use of an assignment operator's result. |
| test.c:17:6:17:13 | ... += ... | Use of an assignment operator's result. |
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,15 @@ void test() {
l1 = l3[l2 = 0]; // NON_COMPLIANT

l1 = l2 = 0; // NON_COMPLIANT

l3[l1 += l2] = l3[l1]; // NON_COMPLIANT

for (l1 = 0; l1 < 10; l1 += l2) // COMPLIANT
{
}

while (l1 < 10) // COMPLIANT
{
l1 += l2; // COMPLIANT
}
}
4 changes: 4 additions & 0 deletions change_notes/2026-05-18-fix-fp-misra-c-13-4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- `RULE-13-4` - `ResultOfAnAssignmentOperatorShouldNotBeUsed`:
- Fixed false positives and false negatives.
- `RULE-8-18-2` - `ResultOfAnAssignmentOperatorShouldNotBeUsed`:
- Fixed false positives and false negatives.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ abstract class ResultOfAnAssignmentOperatorShouldNotBeUsedSharedQuery extends Qu

Query getQuery() { result instanceof ResultOfAnAssignmentOperatorShouldNotBeUsedSharedQuery }

query predicate problems(AssignExpr e, string message) {
query predicate problems(Assignment e, string message) {
not isExcluded(e, getQuery()) and
not exists(ExprStmt s | s.getExpr() = e) and
not exists(ForStmt for | for.getUpdate() = e) and
Comment thread
mbaluda marked this conversation as resolved.
message = "Use of an assignment operator's result."
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
| test.cpp:9:7:9:12 | ... = ... | Use of an assignment operator's result. |
| test.cpp:13:11:13:16 | ... = ... | Use of an assignment operator's result. |
| test.cpp:15:8:15:13 | ... = ... | Use of an assignment operator's result. |
| test.cpp:17:6:17:13 | ... += ... | Use of an assignment operator's result. |
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,15 @@ void test() {
l1 = l3[l2 = 0]; // NON_COMPLIANT

l1 = l2 = 0; // NON_COMPLIANT
}

l3[l1 += l2] = l3[l1]; // NON_COMPLIANT
Comment thread
mbaluda marked this conversation as resolved.
Comment thread
mbaluda marked this conversation as resolved.

for (l1 = 0; l1 < 10; l1 += l2) // COMPLIANT
{
}

while (l1 < 10) // COMPLIANT
{
l1 += l2; // COMPLIANT
}
}
Loading