Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue 755 and typo in A18-1-1 test #773

Merged
merged 7 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 2 additions & 0 deletions change_notes/2024-10-22-fix-fp-m6-5-3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `M6-5-3` - `Loops.qll`:
- Fixes #755. Specifies that the access to the loop counter must be via non-const address.
4 changes: 2 additions & 2 deletions cpp/autosar/test/rules/A18-1-1/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ int test_c_arrays() {
int x[100]; // NON_COMPLIANT
constexpr int a[]{0, 1, 2}; // NON_COMPLIANT

__func__; // COMPLAINT
__func__; // COMPLIANT
return 0;
}
}
4 changes: 2 additions & 2 deletions cpp/common/src/codingstandards/cpp/Loops.qll
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ predicate isLoopCounterModifiedInCondition(ForStmt forLoop, VariableAccess loopC
loopCounterAccess = getAnIterationVariable(forLoop).getAnAccess() and
(
loopCounterAccess.isModified() or
loopCounterAccess.isAddressOfAccess()
loopCounterAccess.isAddressOfAccessNonConst()
lcartey marked this conversation as resolved.
Show resolved Hide resolved
)
}

Expand All @@ -219,7 +219,7 @@ predicate isLoopCounterModifiedInStatement(
loopCounterAccess = loopCounter.getAnAccess() and
(
loopCounterAccess.isModified() or
loopCounterAccess.isAddressOfAccess()
loopCounterAccess.isAddressOfAccessNonConst()
lcartey marked this conversation as resolved.
Show resolved Hide resolved
) and
forLoop.getStmt().getChildStmt*() = loopCounterAccess.getEnclosingStmt()
}
Expand Down