Check for bitwise operations on signed integers
Check ID:
mathworks.misra.CompliantCGIRConstructions
Identify Simulink blocks that contain bitwise operations on signed integers.
Description
Following the recommendations of this check increases the likelihood of generating MISRA C:2012 and MISRA C:2023 compliant code for embedded applications, as well as code that complies with the CERT C and CWE standards.
Available with Embedded Coder® and Simulink® Check™.
Note
Stateflow® license is needed if the model contains Stateflow elements.
Results and Recommended Actions
| Condition | Recommended Action |
|---|---|
| The model has blocks that contain bitwise operations on signed integers. | Consider using unsigned integers for bitwise operations. |
Capabilities and Limitations
Check operates at the generated code level rather than the model level. Consequently, it might not flag blocks if the generated code does not exhibit insecure input validation, even if the underlying model could potentially produce such issues. To overcome this limitation, use the Check usage of bit operation blocks check, which is designed to detect insecure input validation at the model level.
See Also
MISRA C:2012, Rule 10.1
MISRA C:2023, Rule 10.1
CERT C, INT13-C
CWE, CWE-682
hisl_0060: Configuration parameters that improve MISRA C compliance
MISRA C (Embedded Coder)