Is there any MISRA rule to find this sideeffect??

Moderators: misra-c, david ward

sprabhakars
Posts: 2
Joined: Thu Aug 02, 2018 11:07 am
Company: Jasmin Infotech

Is there any MISRA rule to find this sideeffect??

Postby sprabhakars » Fri Aug 03, 2018 1:02 pm


dg1980
Posts: 108
Joined: Wed Apr 27, 2016 2:33 pm
Company: Elektrobit Automotive GmbH

Re: Is there any MISRA rule to find this sideeffect??

Postby dg1980 » Mon Aug 06, 2018 5:50 am


sprabhakars
Posts: 2
Joined: Thu Aug 02, 2018 11:07 am
Company: Jasmin Infotech

Re: Is there any MISRA rule to find this sideeffect??

Postby sprabhakars » Mon Aug 06, 2018 10:46 am


dg1980
Posts: 108
Joined: Wed Apr 27, 2016 2:33 pm
Company: Elektrobit Automotive GmbH

Re: Is there any MISRA rule to find this sideeffect??

Postby dg1980 » Tue Aug 07, 2018 6:06 am

Unfortunately, both operands to < are "essentially unsigned" so none of the 10.x rules is violated.
The printf/return statements however violate rule 2.1 "unreachable code".
But as you already witnessed, that is difficult to track down during static analysis (the code needs to be executed during analysis).

Francois
Posts: 9
Joined: Thu Jul 13, 2017 2:22 pm
Company: TE CONNECTIVITY

Re: Is there any MISRA rule to find this sideeffect??

Postby Francois » Wed Aug 22, 2018 7:52 am

Hi
Isn't there a rule to ensure that comparison is perform on same object type?

dg1980
Posts: 108
Joined: Wed Apr 27, 2016 2:33 pm
Company: Elektrobit Automotive GmbH

Re: Is there any MISRA rule to find this sideeffect??

Postby dg1980 » Thu Oct 04, 2018 11:30 am



Last bumped by dg1980 on Thu Oct 04, 2018 11:30 am.


Return to “8.13 Side effects”

Who is online

Users browsing this forum: No registered users and 0 guests