Support of MISRA C++ Analyzer for Reliability of Embedded Systems
Article No.: 9, Pages 1 - 27
Abstract
Cyber-Physical Systems (CPS) are increasingly used in many complex applications, such as autonomous delivery drones, the automotive CPS design, power grid control systems, and medical robotics. However, existing programming languages lack certain design patterns for CPS designs, including temporal semantics and concurrency models. Future research directions may involve programming language extensions to support CPS designs. However, JSF++, MISRA, and MISRA C++ are providing specifications intended to increase the reliability of safety-critical systems. This article also describes the development of rule checkers based on the MISRA C++ specification using the Clang open-source tool, which allows for the annotation of code and the easy extension of the MISRA C++ specification to other programming languages and systems. This is potentially useful for future CPS language research extensions to work with reliability software specifications using the Clang tool. Experiments were performed using key C++ benchmarks to validate our method in comparison with the well-known Coverity commercial tool. We illustrate key rules related to class, inheritance, template, overloading, and exception handling. Open-source benchmarks that violate the rules detected by our checkers are also illustrated. A random graph generator is further used to generate diamond case with multiple inheritance test data for our software validations. The experimental results demonstrate that our method can provide information that is more detailed than that obtained using Coverity for nine open-source C++ benchmarks. Since the Clang tool is widely used, it will further allow developers to annotate their own extensions.
A Appendix
Listing 21 gives the program generated for Figure 5. The class names correspond to the node numbers in the graph. The node numbers in Figure 5 are converted to characters. The node 0 is converted to A and the node 1 is converted to B, and so on. There are randomly generated variables inside these generated classes, for the generality of the programs. We can see that there are three virtual inheritances inside the program. Two of them are within the diamond structure formatted by D, G, N, and I classes, which correspond to nodes 3, 6, 13, and 8. We generated programs for the graph to be used as the validation test suites for the diamond case.
Listing 21.

Table 7.
Required | |||||||||
Rule 0-1-3 | Rule 0-1-4 | Rule 0-1-5 | Rule 0-1-7 | Rule 0-1-10 | Rule 0-1-11 | Rule 0-1-12 | Rule 2-3-1 | Rule 2-7-1 | Rule 2-7-2 |
Rule 2-10-3 | Rule 2-10-4 | Rule 2-10-6 | Rule 2-13-1 | Rule 2-13-2 | Rule 2-13-4 | Rule 2-13-5 | Rule 3-1-2 | Rule 3-1-3 | Rule 3-2-1 |
Rule 3-3-2 | Rule 3-9-1 | Rule 3-9-3 | Rule 4-5-1 | Rule 4-5-2 | Rule 4-5-3 | Rule 4-10-1 | Rule 4-10-2 | Rule 5-0-3 | Rule 5-0-5 |
Rule 5-0-6 | Rule 5-0-7 | Rule 5-0-8 | Rule 5-0-9 | Rule 5-0-10 | Rule 5-0-11 | Rule 5-0-12 | Rule 5-0-13 | Rule 5-0-14 | Rule 5-0-15 |
Rule 5-0-19 | Rule 5-0-20 | Rule 5-0-21 | Rule 5-2-4 | Rule 5-2-5 | Rule 5-2-6 | Rule 5-2-8 | Rule 5-2-11 | Rule 5-2-12 | Rule 5-3-1 |
Rule 5-3-2 | Rule 5-3-3 | Rule 5-3-4 | Rule 5-14-1 | Rule 5-18-1 | Rule 6-2-2 | Rule 6-2-3 | Rule 6-3-1 | Rule 6-4-1 | Rule 6-4-2 |
Rule 6-4-3 | Rule 6-4-4 | Rule 6-4-5 | Rule 6-4-6 | Rule 6-4-7 | Rule 6-4-8 | Rule 6-5-2 | Rule 6-5-3 | Rule 6-5-4 | Rule 6-5-6 |
Rule 6-6-1 | Rule 6-6-2 | Rule 6-6-4 | Rule 6-6-5 | Rule 7-1-2 | Rule 7-2-1 | Rule 7-3-1 | Rule 7-3-2 | Rule 7-3-3 | Rule 7-3-4 |
Rule 7-3-5 | Rule 7-3-6 | Rule 7-4-2 | Rule 7-4-3 | Rule 7-5-1 | Rule 7-5-3 | Rule 8-0-1 | Rule 8-3-1 | Rule 8-4-1 | Rule 8-4-2 |
Rule 8-4-3 | Rule 8-4-4 | Rule 8-5-1 | Rule 8-5-2 | Rule 8-5-3 | Rule 9-3-1 | Rule 9-3-2 | Rule 9-3-3 | Rule 9-5-1 | Rule 9-6-2 |
Rule 9-6-3 | Rule 9-6-4 | Rule 10-1-2 | Rule 10-1-3 | Rule 10-3-1 | Rule 10-3-2 | Rule 10-3-3 | Rule 11-0-1 | Rule 12-1-1 | Rule 12-1-3 |
Rule 12-8-1 | Rule 12-8-2 | Rule 14-5-2 | Rule 14-5-3 | Rule 14-6-1 | Rule 14-6-2 | Rule 14-7-1 | Rule 14-7-3 | Rule 14-8-1 | Rule 15-0-3 |
Rule 15-1-1 | Rule 15-1-2 | Rule 15-5-3 | Rule 16-0-1 | Rule 16-0-2 | Rule 16-0-3 | Rule 16-0-4 | Rule 16-0-5 | Rule 16-0-7 | Rule 16-0-8 |
Rule 16-1-2 | Rule 16-2-1 | Rule 16-3-1 | Rule 17-0-5 | Rule 18-0-1 | Rule 18-0-2 | Rule 18-0-3 | Rule 18-0-4 | Rule 18-0-5 | Rule 18-2-1 |
Rule 18-4-1 | Rule 19-3-1 | Rule 27-0-1 | |||||||
Advisory | |||||||||
Rule 2-5-1 | Rule 2-10-5 | Rule 3-9-2 | Rule 5-0-2 | Rule 5-2-3 | Rule 5-2-9 | Rule 5-2-10 | Rule 5-19-1 | Rule 10-1-1 | Rule 10-2-1 |
Rule 12-1-2 | Rule 14-8-2 | Rule 15-0-2 | Rule 15-3-2 | Rule 16-3-2 |
References
[1]
Ali Almossawi, Kelvin Lim, and Tanmay Sinha. 2006. Analysis tool evaluation: Coverity prevent. Carnegie Mellon University, Pittsburgh, PA, 7–11. Retrieved from https://www.cs.cmu.edu/aldrich/courses/654-sp07/tools/cure-coverity-06.pdf
[2]
Pascal Bertschi and Andreas Deicha. 2018. Safe C++ Guidelines Checkers und Quick Fixes. Ph. D. Dissertation. HSR Hochschule für Technik Rapperswil.
[3]
Po-Yao Chang, Tai-Liang Chen, and Jenq-Kuen Lee. 2021. Enabling the use of C++ 20 unseq execution policy for OpenCL. In Proceedings of the International Workshop on OpenCL. 1–2.
[4]
Peng-Sheng Chen, Yuan-Shin Hwang, Roy Dz-Ching Ju, and Jenq-Kuen Lee. 2004. Interprocedural probabilistic pointer analysis. IEEE Trans. Parallel Distrib. Syst. 15 (Oct. 2004), 893–907. Issue 10.
[5]
Clang 2008. scan-build. Clang, Retrieved from https://clang-analyzer.llvm.org/scan-build.html
[6]
Clang 2020. Android Auto Framework. Clang. Retrieved from https://www.android.com/auto/
[7]
Clang 2020. Clang-Tidy. Clang. Retrieved from https://clang.llvm.org/extra/clang-tidy/
[8]
Clang 2020. GENEVI Framework. Clang. Retrieved from https://www.genivi.org/
[9]
Daniel Cordeiro, Grégory Mounié, Swann Perarnau, Denis Trystram, Jean-Marc Vincent, and Frédéric Wagner. 2010. Random graph generation for scheduling simulations. In Proceedings of the 3rd International ICST Conference on Simulation Tools and Techniques (SIMUTools’10). ICST, 10.
[10]
Chris Cox. 2018. CppPerformanceBenchmarks-Release5. Retrieved from https://gitlab.com/chriscox/CppPerformanceBenchmarks
[11]
H. Carter Edwards, Christian R. Trott, and Daniel Sunderland. 2014. Kokkos: Enabling manycore performance portability through polymorphic memory access patterns. J. Parallel Distrib. Comput. 74, 12 (2014), 3202–3216.
[12]
Google 2016. Google Test. Google. Retrieved from https://github.com/google/googletest
[13]
Google 2017. Google Logging Library. Google. Retrieved from https://github.com/google/glog
[14]
Hervé Guihot. 2012. RenderScript. In Pro Android Apps Performance Optimization. Springer, 231–263.
[15]
Ming-Yu Hung, Peng-Sheng Chen, Yuan-Shin Hwang, Roy Dz-Ching Ju, and Jenq-Kuen Lee. 2012. Support of probabilistic pointer analysis in the SSA Form. IEEE Trans. Parallel Distrib. Syst. 23 (Dec. 2012), 23661–2379. Issue 12.
[16]
Daniel Kästner, Christoph Cullmann, Gernot Gebhard, Sebastian Hahn, Thomas Karos, Laurent Mauborgne, Stephan Wilhelm, and Christian Ferdinand. 2020. Safety-critical software development in C++. In Proceedings of the International Conference on Computer Safety, Reliability, and Security. Springer, 98–110.
[17]
Ullrich Koethe. 2017. VIGRA Computer Vision Library. Retrieved from https://github.com/zeromq/libzmq
[18]
Ted Kremenek. 2008. Finding software bugs with the clang static analyzer. Apple Inc.
[19]
Chris Lattner. 2008. LLVM and clang: Next generation compiler technology. In Proceedings of the BSD Conference, Vol. 5.
[20]
Jenq Kuen Lee and Dennis Gannon. 1991. Object oriented parallel programming: Experiments and results. In Proceedings of the ACM/IEEE Conference on Supercomputing (Supercomputing’91). IEEE, 273–282.
[21]
Cheng-Yen Lin, Chung-Wen Huang, Chi-Bang Kuan, Shi-Yu Huang, and Jenq-Kuen Lee. 2015. The design and experiments of A SID-based power-aware simulator for embedded multicore systems. ACM Trans. Design Autom. Electr. Syst. 20, 2 (2015), 1–27.
[22]
Yu-Te Lin and Jenq-Kuen Lee. 2016. Vector data flow analysis for SIMD optimizations on OpenCL programs. Concurr. Comput.: Pract. Exp. 28, 5 (2016), 1629–1654.
[23]
Yang Liu, Yu Peng, Bailing Wang, Sirui Yao, and Zihe Liu. 2017. Review on cyber-physical systems. IEEE/CAA J. Autom. Sinica 4, 1 (2017), 27–40.
[24]
MISRA 2020. MISRA C:2012 Amendment 2. MISRA. Retrieved from https://www.misra.org.uk/Publications/tabid/57/Default.aspx
[25]
Jason Sanders and Edward Kandrot. 2010. CUDA by Example: An Introduction to General-purpose GPU Programming. Addison-Wesley Professional.
[26]
Sass. 2018. LibSass—Sass Compiler Written in C++. Sass. Retrieved from https://github.com/sass/libsass
[27]
Wen-Li Shih, Yi-Ping You, Chung-Wen Huang, and Jenq Kuen Lee. 2014. Compiler optimization for reducing leakage power in multithread bsp programs. ACM Trans. Design Autom. Electr. Syst. 20, 1 (2014), 1–34.
[28]
Sourcey 2018. LibSourcey. Sourcey. Retrieved from https://github.com/sourcey/libsourcey
[29]
Bjarne Stroustrup, K. Carroll, and L. Aero. 2006. C++ in safety-critical applications: The JSF++ coding standard. https://www.phaedsys.com/principals/programmingresearch/prdata/SSE-Session-4_Stroustrup-Carroll.pdf
[30]
Yulei Sui and Jingling Xue. 2016. SVF: Interprocedural static value-flow analysis in LLVM. In Proceedings of the 25th International Conference on Compiler Construction (CC’16). ACM, 265–266.
[31]
Y. Sui, D. Ye, and J. Xue. 2014. Detecting memory leaks statically with full-sparse value-flow analysis. IEEE Trans. Softw. Eng. 40, 2 (Feb. 2014), 107–122.
[32]
Chris Tapp. 2008. An introduction to MISRA C++. SAE Int. J. Passeng. Cars—Electron. Electr. Syst. 1 (Apr. 2008), 265–268. DOI:
[33]
The FLTK Team 2019. Fast Light Toolkit. The FLTK Team. Retrieved from https://github.com/fltk/fltk
[34]
Shao-Chung Wang, Lin-Ya Yu, Li-An Her, Hwang Yuan-Shin, and Jenq-Kuen Lee. December 2021. Pointer-based divergence analysis for OpenCL 2.0 programs. ACM Trans. Parallel Comput. 8, 20 (Dec. 2021), 1–23. Issue 4.
[35]
Wu Yinghao. 2013. Cplusplus_Thread_Lib. Retrieved from https://github.com/wyh267/Cplusplus_Thread_Lib
[36]
ZeroMQ 2019. ZeroMQ Lightweight Messaging Kernel. ZeroMQ. Retrieved from https://github.com/zeromq/libzmq
[37]
Yang Zhao, Jie Liu, and Edward A. Lee. 2007. A programming model for time-synchronized distributed real-time systems. In Proceedings of the 13th IEEE Real Time and Embedded Technology and Applications Symposium (RTAS’07). 259–268.
Index Terms
- Support of MISRA C++ Analyzer for Reliability of Embedded Systems
Comments
Information & Contributors
Information
Published In

Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].
Publisher
Association for Computing Machinery
New York, NY, United States
Journal Family
Publication History
Published: 22 January 2025
Online AM: 31 July 2023
Accepted: 20 July 2023
Revised: 05 July 2023
Received: 15 January 2023
Published in TCPS Volume 9, Issue 1
Check for updates
Author Tags
Qualifiers
- Research-article
Contributors
Other Metrics
Bibliometrics & Citations
Bibliometrics
Article Metrics
- 0Total Citations
- 854Total Downloads
- Downloads (Last 12 months)501
- Downloads (Last 6 weeks)41
Reflects downloads up to 07 Mar 2025
Other Metrics
Citations
View Options
Login options
Check if you have access through your login credentials or your institution to get full access on this article.
Sign in