MISRA C:2023 Rule 1.3
There shall be no occurrence of undefined or critical unspecified behaviour
Since R2024a
Description
Rule Definition
There shall be no occurrence of undefined or critical unspecified behaviour.
Rationale
C code that results in undefined or critical unspecified behavior might produce unexpected or incorrect results. Such code might behave differently in different implementations. Issues caused by undefined behavior in the code might be difficult to analyze because compilers might optimize the code assuming that undefined behavior does not occur.
Note
Many MISRA C:2012 rules address specific undefined or critical unspecified behaviors. This rule applies to any undefined or critical unspecified behavior that is not addressed in any other rule.
Polyspace Implementation
Polyspace® flags these instances of undefined or critical undefined behavior:
Use of
offsetof
on bit fields.Use of
offsetof
when the second argument is not astruct
field of the first argument.Use of
defined
without an identifier.Use of an array of incomplete types.
Use of a function like macros by using incorrect number of arguments (C90 only).
Troubleshooting
If you expect a rule violation but do not see it, refer to Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: Standard C Environment |
Category: Required |
AGC Category: Required |
Version History
Introduced in R2024a