Proposal: Rule 0-1-4 exception

Moderators: david ward, misra cpp

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

Proposal: Rule 0-1-4 exception

Post by dg1980 » Thu Oct 27, 2016 12:16 pm

Exception: Variables which are written by the program but read by an external entity (e.g. ASAM MCD tools like Vector CANape) are not considered a violation of this rule.

mishak
Posts: 10
Joined: Thu Jun 21, 2007 3:58 pm

Re: Proposal: Rule 0-1-4 exception

Post by mishak » Thu Oct 27, 2016 12:24 pm

This rule reports (e.g.) dead stores as they may be the sign of a defect.

As with your proposal for an exception to 0-1-3, there would be no way for a tool to know that the intent is for the value to be read by something other than the program.

You would, of course, also have to ensure that any objects have volatile qualification to ensure that the compiler does not optimise out what it sees as dead stores.

Looks like another candidate for a permit / deviation (which needs to include a requirement for volatile qualification).

misra cpp
Posts: 148
Joined: Mon Jun 02, 2008 1:55 pm
Company: MISRA

Re: Proposal: Rule 0-1-4 exception

Post by misra cpp » Tue Jan 24, 2017 9:47 am

We agree with mishak, whilst a valid reason for a deviation, there is no way of expressing this as a checkable exception to the rule, as a static analysis tool cannot know what use other software is going to make of a variable
Posted by and on behalf of
the MISRA C++ Working Group

Post Reply

Return to “6.0 Language independent issues (C++)”