Even after following MISRA Guidelines and Model adviser ran with zero errors POLYSPACE is throwing MISRA C 2012 violations
조회 수: 2 (최근 30일)
이전 댓글 표시

댓글 수: 2
Walter Roberson
2025년 1월 17일
u8_retriesCounter hints that you are working with an 8 bit unsigned value. In C when you add 1 to the maximum 8 bit unsigned value, the value overflows back to 0 rather than saturating.
I am not currently convinced that qY is anything other than 8 bit unsigned; if so then it cannot be greater than 255.
Walter Roberson
2025년 1월 21일
Better code would be
if SMIT_EHL_LITE_b_DW.u8_retriesCounter >= 254U
qy = 255U;
else
qy = SMIT_EHL_LITE_b_DW.u8_retriesCounter + 1U;
end
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 MISRA C:2012 Directives and Rules에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!