Main Content

Undecidable MISRA C:2012 Rules and Directives Supported by Polyspace Bug Finder

The MISRA C:2012 standard classifies rules and directives that cannot be statically enforced in every possible cases as Undecidable. Polyspace® supports 44 out of 51 such rules, and 18 out of 21 such directives.

Undecidable Rules

A rule is undecidable if a static analysis tool can check compliance to it only in certain cases. Polyspace shows the subset of all possible issues. For details about which issues Polyspace detects for a particular rule, see the Polyspace Implementation section in the reference page of the rule. Polyspace supports 44 out of 51 such rules.

MISRA C:2012 RuleDescriptionPolyspace Checker
MISRA C:2012 Rule 12.2The right hand operand of a shift operator shall lie in the range zero to one less than the width in bits of the essential type of the left hand operandMISRA C:2012 Rule 12.2
MISRA C:2012 Rule 13.1Initializer lists shall not contain persistent side effectsMISRA C:2012 Rule 13.1
MISRA C:2012 Rule 13.2The value of an expression and its persistent side effects shall be the same under all permitted evaluation orders and shall be independent from thread interleavingMISRA C:2012 Rule 13.2
MISRA C:2012 Rule 13.5The right hand operand of a logical && or || operator shall not contain persistent side effectsMISRA C:2012 Rule 13.5
MISRA C:2012 Rule 14.1A loop counter shall not have essentially floating typeMISRA C:2012 Rule 14.1
MISRA C:2012 Rule 14.2A for loop shall be well-formedMISRA C:2012 Rule 14.2
MISRA C:2012 Rule 14.3Controlling expressions shall not be invariantMISRA C:2012 Rule 14.3
MISRA C:2012 Rule 17.11A function that never returns should be declared with a _Noreturn function specifierMISRA C:2012 Rule 17.11
MISRA C:2012 Rule 17.2Functions shall not call themselves, either directly or indirectlyMISRA C:2012 Rule 17.2
MISRA C:2012 Rule 17.5The function argument corresponding to a parameter declared to have an array type shall have an appropriate number of elementsMISRA C:2012 Rule 17.5
MISRA C:2012 Rule 17.8A function parameter should not be modifiedMISRA C:2012 Rule 17.8
MISRA C:2012 Rule 17.9A function declared with a _Noreturn function specifier shall not return to its callerMISRA C:2012 Rule 17.9
MISRA C:2012 Rule 18.1A pointer resulting from arithmetic on a pointer operand shall address an element of the same array as that pointer operandMISRA C:2012 Rule 18.1
MISRA C:2012 Rule 18.2Subtraction between pointers shall only be applied to pointers that address elements of the same arrayMISRA C:2012 Rule 18.2
MISRA C:2012 Rule 18.3The relational operators >, >=, < and <= shall not be applied to expressions of pointer type except where they point into the same objectMISRA C:2012 Rule 18.3
MISRA C:2012 Rule 18.6The address of an object with automatic or thread-local storage shall not be copied to another object that persists after the first object has ceased to existMISRA C:2012 Rule 18.6
MISRA C:2012 Rule 19.1An object shall not be assigned or copied to an overlapping objectMISRA C:2012 Rule 19.1
MISRA C:2012 Rule 1.2Language extensions should not be usedMISRA C:2012 Rule 1.2
MISRA C:2012 Rule 1.3There shall be no occurrence of undefined or critical unspecified behaviourMISRA C:2012 Rule 1.3
MISRA C:2012 Rule 1.5Obsolescent language features shall not be usedMISRA C:2012 Rule 1.5
MISRA C:2012 Rule 21.13Any value passed to a function in <ctype.h> shall be representable as an unsigned char or be the value EOFMISRA C:2012 Rule 21.13
MISRA C:2012 Rule 21.14The Standard Library function memcmp shall not be used to compare null terminated stringsMISRA C:2012 Rule 21.14
MISRA C:2012 Rule 21.17Use of the string handling function from <string.h> shall not result in accesses beyond the bounds of the objects referenced by their pointer parametersMISRA C:2012 Rule 21.17
MISRA C:2012 Rule 21.18The size_t argument passed to any function in <string.h> shall have an appropriate valueMISRA C:2012 Rule 21.18
MISRA C:2012 Rule 21.19The pointers returned by the Standard Library functions localeconv, getenv, setlocale or strerror shall only be used as if they have pointer to const-qualified typeMISRA C:2012 Rule 21.19
MISRA C:2012 Rule 21.20The pointer returned by the Standard Library functions asctime, ctime, gmtime, localtime, localeconv, getenv, setlocale or strerror shall not be used following a subsequent call to the same functionMISRA C:2012 Rule 21.20
MISRA C:2012 Rule 22.1All resources obtained dynamically by means of Standard Library functions shall be explicitly releasedMISRA C:2012 Rule 22.1
MISRA C:2012 Rule 22.10The value of errno shall only be tested when the last function to be called was an errno-setting functionMISRA C:2012 Rule 22.10
MISRA C:2012 Rule 22.11A thread that was previously either joined or detached shall not be subsequently joined nor detachedMISRA C:2012 Rule 22.11
MISRA C:2012 Rule 22.15Thread synchronization objects and thread-specific storage pointers shall not be destroyed until after all threads accessing them have terminatedMISRA C:2012 Rule 22.15
MISRA C:2012 Rule 22.16All mutex objects locked by a thread shall be explicitly unlocked by the same threadMISRA C:2012 Rule 22.16
MISRA C:2012 Rule 22.17No thread shall unlock a mutex or call cnd_wait() or cnd_timedwait() for a mutex it has not locked beforeMISRA C:2012 Rule 22.17
MISRA C:2012 Rule 22.2A block of memory shall only be freed if it was allocated by means of a Standard Library functionMISRA C:2012 Rule 22.2
MISRA C:2012 Rule 22.3The same file shall not be open for read and write access at the same time on different streamsMISRA C:2012 Rule 22.3
MISRA C:2012 Rule 22.4There shall be no attempt to write to a stream which has been opened as read-onlyMISRA C:2012 Rule 22.4
MISRA C:2012 Rule 22.5A pointer to a FILE object shall not be dereferencedMISRA C:2012 Rule 22.5
MISRA C:2012 Rule 22.6The value of a pointer to a FILE shall not be used after the associated stream has been closedMISRA C:2012 Rule 22.6
MISRA C:2012 Rule 22.7The macro EOF shall only be compared with the unmodified return value from any Standard Library function capable of returning EOFMISRA C:2012 Rule 22.7
MISRA C:2012 Rule 22.8The value of errno shall be set to zero prior to a call to an errno-setting-functionMISRA C:2012 Rule 22.8
MISRA C:2012 Rule 22.9The value of errno shall be tested against zero after calling an errno-setting functionMISRA C:2012 Rule 22.9
MISRA C:2012 Rule 2.1A project shall not contain unreachable codeMISRA C:2012 Rule 2.1
MISRA C:2012 Rule 2.2A project shall not contain dead codeMISRA C:2012 Rule 2.2
MISRA C:2012 Rule 8.13A pointer should point to a const-qualified type whenever possibleMISRA C:2012 Rule 8.13
MISRA C:2012 Rule 9.1The value of an object with automatic storage duration shall not be read before it has been setMISRA C:2012 Rule 9.1

Undecidable Directives

A directive is undecidable if a static analysis tool can check compliance to it only in certain cases. Polyspace shows the subset of all possible issues. For details about which issues Polyspace detects for a particular directive, see the Polyspace Implementation section in the reference page of the directive. Polyspace supports 18 out of 21 such directives.

MISRA C:2012 DirectivesDescriptionPolyspace Checker
MISRA C:2012 Dir 1.1Any implementation-defined behavior on which the output of the program depends shall be documented and understoodMISRA C:2012 Dir 1.1
MISRA C:2012 Dir 2.1All source files shall compile without any compilation errorsMISRA C:2012 Dir 2.1
MISRA C:2012 Dir 4.1Run-time failures shall be minimizedMISRA C:2012 Dir 4.1
MISRA C:2012 Dir 4.10Precautions shall be taken in order to prevent the contents of a header file being included more than onceMISRA C:2012 Dir 4.10
MISRA C:2012 Dir 4.11The validity of values passed to library functions shall be checkedMISRA C:2012 Dir 4.11
MISRA C:2012 Dir 4.12Dynamic memory allocation shall not be usedMISRA C:2012 Dir 4.12
MISRA C:2012 Dir 4.13Functions which are designed to provide operations on a resource should be called in an appropriate sequenceMISRA C:2012 Dir 4.13
MISRA C:2012 Dir 4.14The validity of values received from external sources shall be checkedMISRA C:2012 Dir 4.14
MISRA C:2012 Dir 4.15Evaluation of floating-point expressions shall not lead to the undetected generation of infinities and NaNsMISRA C:2012 Dir 4.15
MISRA C:2012 Dir 4.3Assembly language shall be encapsulated and isolatedMISRA C:2012 Dir 4.3
MISRA C:2012 Dir 4.4Sections of code should not be "commented out"MISRA C:2012 Dir 4.4
MISRA C:2012 Dir 4.5Identifiers in the same name space with overlapping visibility should be typographically unambiguousMISRA C:2012 Dir 4.5
MISRA C:2012 Dir 4.6typedefs that indicate size and signedness should be used in place of the basic numerical typesMISRA C:2012 Dir 4.6
MISRA C:2012 Dir 4.7If a function returns error information, then that error information shall be testedMISRA C:2012 Dir 4.7
MISRA C:2012 Dir 4.8If a pointer to a structure or union is never dereferenced within a translation unit, then the implementation of the object should be hiddenMISRA C:2012 Dir 4.8
MISRA C:2012 Dir 4.9A function should be used in preference to a function-like macro where they are interchangeableMISRA C:2012 Dir 4.9
MISRA C:2012 Dir 5.1There shall be no data races between threadsMISRA C:2012 Dir 5.1
MISRA C:2012 Dir 5.2There shall be no deadlocks between threadsMISRA C:2012 Dir 5.2

See Also

Related Topics