Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





  MISRA C ADC available - superseded
Posted by: david ward - 06-03-2013, 01:28 PM - Forum: Announcements - No Replies

This document has now been superseded by MISRA Compliance:2016. The following description is retained for archival purposes.

MISRA is pleased to announce the availability of an additional resource for MISRA C, MISRA C ADC Approved deviation compliance for MISRA C:2004.

MISRA C is intended to be used within the framework of a disciplined software development process. The MISRA C:2004 guidelines (Section 4.3.2) permit controlled deviation from the rules when software safety and/or quality requirements cannot otherwise be satisfied.

It should be understood that a deviation can only be adequately justified when supported by information such as:

  • An appropriate reason for the need to raise a deviation;
  • A description of the extent to which a relaxation of the rule is being introduced;
  • An argument to support the reasons for the deviation;
  • Measures which must be observed to ensure safety and/or quality.
MISRA C ADC was a technical note that was a first step in describing the requirements in greater detail. It focused solely on the first of these topics, the common reasons for raising a deviation.

Print this item

  MISRA C ADC - superseded
Posted by: david ward - 06-03-2013, 01:21 PM - Forum: MISRA C resources - No Replies

This document has now been superseded by MISRA Compliance:2016. The following description is retained for archival purposes.

MISRA C is intended to be used within the framework of a disciplined software development process. The MISRA C:2004 guidelines (Section 4.3.2) permit controlled deviation from the rules when software safety and/or quality requirements cannot otherwise be satisfied.

It should be understood that a deviation can only be adequately justified when supported by information such as:

  • An appropriate reason for the need to raise a deviation;
  • A description of the extent to which a relaxation of the rule is being introduced;
  • An argument to support the reasons for the deviation;
  • Measures which must be observed to ensure safety and/or quality.
MISRA C ADC was a technical note that was a first step in describing the requirements in greater detail. It focuses solely on the first of these topics, the common reasons for raising a deviation.

Print this item

  MISRA C:2012 publication date
Posted by: david ward - 26-02-2013, 01:02 PM - Forum: Announcements - No Replies

MISRA is very pleased to announced today at Embedded World that the next edition of MISRA C Guidelines for the use of the C language in critical systems, to be known as MISRA C:2012, will be available from the MISRA webstore from 18 March 2013. Initially PDF copies will be available to purchase, with print copies available about 2 weeks later.

MISRA C:2012 extends support to the C99 version of the C language (while maintaining guidelines for C90), in addition to including a number of improvements that can reduce the cost and complexity of compliance, whilst aiding consistent, safe use of C in critical systems. Improvements, many of which have been made as a result of user feedback, include: better rationales for every guideline, identified decidability so users can better interpret the output of checking tools, greater granularity of rules to allow more precise control, a number of expanded examples and integration of MISRA AC AGC. A cross reference for ISO 26262 has also been produced.

Check back here for further details or subscribe to the MISRA mailing list to stay informed.

Print this item

  Rule 14–7–3 Example errata?
Posted by: minhyuk - 07-02-2013, 11:58 PM - Forum: 6.14 Templates (C++) - Replies (1)

See 14-7-3 Example:

a function template specialization for good_tmp1 violated ODR in tmp1.cc.

Code:
// tmp1.h
template  void good_tmp1 ( ) { }

// tmp1.cc
#include "tmp1.h"
template  void good_tmp1 ( ) { }

I think function template specialization must be forward declaration in header file.
any reason for that?

Best Regards,
Minhyuk Kwon@Suresoft technologies Incs.

Print this item

  8.7 and design for testatbility
Posted by: ggentile - 24-01-2013, 03:08 PM - Forum: 6.8 Declarations and Definitions - Replies (1)

It seems that the 8.7 rule contradict design for testability.
Infact when you have a static variabile defined at block level, right now you have no way to perform any white box testing withot changing/adding code to copy the value to a global variable.

Let me know

Giacomo

Print this item

  Rule 17.4 - array elements contained inside structure def
Posted by: sshidore - 21-01-2013, 08:08 AM - Forum: 6.17 Pointers and Arrays - Replies (1)

• MISRA C rule 17.4 says arithmetic operations shall not be performed on pointers, as they may result into referencing to non-existing addresses.
• Alternative to this is to catch a pointer being received as an argument into the respective type of an array, for e.g. catch ‘&arr’ into ‘arr[]’, and use array indexing to access its elements. This works well for pointers of basic data types.
• Problem arises in the case of accessing array elements contained by a structure.
• e.g.
struct message
{
int address;
int length;
int data[50];
}m1,m2;

• Now, the statement “source_node = m1.data[SOURCE_NODE_INDEX]” triggers this 17.4 non-compliance note.
• This happens when accessing only the array elements, and not for single variables of a structure definition.
• So the question I have is, what is the best way to access individual array elements contained inside a structure definition?

Print this item

  Application of rule 14.10 for Autogenerated code
Posted by: ssauvage - 14-01-2013, 01:49 PM - Forum: MISRA AC AGC discussions - Replies (1)

I have recently received a question from a customer using our code generation tools (embedded coder).
The code that we generate for a block (saturate block) is like this:

Code:
rtB_out = something;
if(rtB_out > maxlim) {
   rtB_out = maxlim;
}
else {
   if(rtB_out < minlim) {
      rtB_out = minlim;
   }
}

The customer asked whether the code above was MISRA compliant, in particular with respect to rule 14.10.
It is an “
Code:
if ... else { if { ... } }
” construct and very close to the “
Code:
if ... else if ...
” construct as described in the rule 14.10.
However, it can be read as a simple if being the statement in an else clause.

Personally, I find the code quite readable as it is and it is easy to check that there is no path where rtB_out is not assigned a value.
Would you recommend to have a final else in this context?

Print this item

  Issues covered by rule 3.1
Posted by: mtempest - 09-01-2013, 05:44 AM - Forum: 6.3 Documentation - Replies (1)

Hi

As I understand it, rule 3.1 is a "catch all" rule that addresses all of the implementation-defined behaviour not addressed by the other rules. However, MISRA-C:2004 does not explicitly list all of those issues, so it is not possible to tell at a glance exactly what falls under rule 3.1. This creates some difficulty determining the extent to which our static analysis software enforces the MISRA rules, and therefore also when enforcing the delta with manual review.

I could draw up a list of those issues using MISRA-C:2004 Appendix G as a guide to determining which of the issues in ISO/IEC 9899:1990 Appendix G are addressed by other rules, and seeing what is left. I could do this, but it is not a 5-minute exercise (for me) and I suspect that this work has already been done many times before now.

Has a list like that been published on the web anywhere? I've tried googling for it, but to no avail.

Kind regards
Michael

Print this item

  Rule 3-2-4 comparison with MISRA C Rule 8.9
Posted by: sarkarsaurabh_27 - 03-01-2013, 06:59 AM - Forum: 6.3 Basic concepts (C++) - Replies (1)

An identifier with external linkage shall have exactly one definition.
The test exemplar provided with MISRA C for rule 8.9 has
// mc2_0809_1.c
int32_t two_different_definitions = 1; /* Not Compliant - two definitions */
// mc2_0809_2.c
int32_t two_different_definitions = 2; /* Not Compliant - two definitions */
// mc2_0809.h
extern int32_t two_different_definitions;

But the example given in the MISRA C++ Guidelines Draft for Rule 3-2-4 is :
// file1.cpp
int32_t i = 0;
// file2.cpp
int32_t i = 1; // Non-compliant

As both the rules are some what same, but the difference in the example given is that in rule 3-2-4 no external linkage is provided. Is it an incomplete example or the rule should show violation without having an extern of the variable.

Print this item

  Dynamic memory allocation - rule 20.4
Posted by: mroczeks - 13-12-2012, 11:49 AM - Forum: 6.20 Standard Libraries - Replies (4)

Hi,

I missed discussion about new Misra C to be released.
Anyway now and then I have several questions and comments about dynamic memory allocation.

In Misra C 2004 there is only one rule (20.4) addressing dynamic memory allocation.
In my opinion it's too little. There are questions not answered by this single rule.

So the questions are:
1. Is this rule only forbiding use of malloc, calloc, realloc and free functions while leaving a room for implementation and use of prorpietary functions?

2. Is proprietary dynamic memory management allowed in any way?

3. I would like to implement my own "heap" (pool) which would allow for memory allocation on startup only and no deallocation anytime. Is this possible without violation of this rule?

In my opinion these questions should be answered in new Misra in some clearer way.

Best regards,
Szymon

Print this item

Search Forums

(Advanced Search)

Forum Statistics
» Members: 6,171
» Latest member: stephanmuench
» Forum threads: 998
» Forum posts: 2,752

Full Statistics

Online Users
There are currently 377 online users.
» 0 Member(s) | 374 Guest(s)
Applebot, Bing, Google

Latest Threads
Rule 6.2.1: non-inline co...
Forum: 4.6 Basic concepts
Last Post: cgpzs
22-11-2024, 10:11 AM
» Replies: 0
» Views: 31
Rule 0.1.2
Forum: 4.0 Language independent issues
Last Post: stephanmuench
21-11-2024, 01:12 PM
» Replies: 0
» Views: 37
A18-9-4
Forum: AUTOSAR C++:2014 rules
Last Post: cgpzs
23-10-2024, 12:04 PM
» Replies: 2
» Views: 382
A8-4-5: are partial moves...
Forum: AUTOSAR C++:2014 rules
Last Post: misra cpp
22-10-2024, 02:03 PM
» Replies: 1
» Views: 329
model information blocks ...
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
22-10-2024, 01:27 PM
» Replies: 1
» Views: 4,446
MISRA AL SLSF - Rule 043I
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
22-10-2024, 01:11 PM
» Replies: 1
» Views: 8,863
MISRA AC EC guidelines
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
21-10-2024, 08:21 AM
» Replies: 4
» Views: 15,508
News on future releases
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
21-10-2024, 08:05 AM
» Replies: 1
» Views: 5,694
Signal naming convention ...
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
21-10-2024, 07:57 AM
» Replies: 1
» Views: 7,250
Rule 7.0.2: operator cons...
Forum: 4.7 Standard conversions
Last Post: karos
14-10-2024, 08:52 PM
» Replies: 2
» Views: 438