Skip to main content
QUICK REVIEW

[Paper Review] Coding Guidelines and Undecidability

Espinha Gasiba, Tiago, Oguzhan, Kaan|arXiv (Cornell University)|Dec 28, 2022
Software Reliability and Analysis ResearchComputer Science3 citations
TL;DR

This paper investigates the impact of undecidability on C/C++ coding guidelines, particularly in MISRA C:2012, and proposes practical improvements to reduce confusion and false positives in static analysis tools. It argues that while undecidable guidelines are unavoidable for safety-critical systems, they can be mitigated through sound, decidable approximations and clearer, more pragmatic directives—such as minimizing unjustified effectless code—thereby balancing safety with developer practicality.

ABSTRACT

Software security is an important topic that is gaining more and more attention due to the rising number of publicly known cybersecurity incidents. Previous research has shown that one way to address software security is by means of a serious game, the CyberSecurity Challenges, which are designed to raise awareness of software developers of secure coding guidelines. This game, which has been proven to be very successful in the industry, makes use of an artificial intelligence technique (laddering technique) to implement a chatbot for human-machine interaction. Recent advances in machine learning led to a breakthrough, with the implementation of ChatGPT by OpenAI. This algorithm has been trained in a large amount of data and is capable of analysing and interpreting not only natural language, but also small code snippets containing source code in different programming languages. With the advent of ChatGPT, and previous state-of-the-art research in secure software development, a natural question arises: to which extent can ChatGPT aid software developers in writing secure software?. In this paper, we draw on our experience in the industry, and also on extensive previous work to analyse and reflect on how to use ChatGPT to aid secure software development. Towards this, we run a small experiment using five different vulnerable code snippets. Our interactions with ChatGPT allow us to conclude on advantages, disadvantages and limitations of the usage of this new technology.

Motivation & Objective

  • To clarify the conceptual and practical challenges posed by undecidability in C/C++ coding guidelines, especially in safety-critical systems.
  • To analyze why undecidable guidelines—particularly those related to unreachable or effectless code—commonly confuse developers and tools.
  • To propose improved guidelines that are more practical and less prone to false positives, while maintaining safety and security assurances.
  • To advocate for better tooling support that distinguishes between true violations and 'don't know' cases, reducing false negatives and false positives.

Proposed method

  • Systematically categorizes all undecidable MISRA C:2012 guidelines based on their underlying undecidable properties, such as run-time behavior and control flow reachability.
  • Analyzes the root causes of undecidability in guidelines related to dead code, unreachable code, and side-effect-free expressions.
  • Proposes a new directive—'Unjustified effectless code shall be minimized'—as a more pragmatic alternative to absolute bans on effectless code.
  • Evaluates the feasibility of decidable approximations for undecidable guidelines, emphasizing soundness and practicality over completeness.
  • Recommends integrating design standards, test plans, and code review checklists to support compliance with new, more flexible directives.
  • Draws parallels with modern language trends (e.g., Rust) to support the shift toward stricter, yet more maintainable, coding practices.

Experimental results

Research questions

  • RQ1Why do undecidable coding guidelines like MISRA C:2012 Rule 2.2 cause confusion in static analysis tools and among developers?
  • RQ2What are the practical consequences of enforcing undecidable guidelines when no general algorithm can verify them?
  • RQ3Can decidable approximations be designed for undecidable guidelines without overly constraining code quality or expressiveness?
  • RQ4How can guidelines be reformulated to reduce false positives while still ensuring safety and security?
  • RQ5What role do tooling limitations—such as false negatives and false positives—play in undermining trust in static analysis for safety-critical systems?

Key findings

  • Many MISRA C:2012 guidelines are undecidable because they depend on run-time properties such as control flow reachability and variable values, which cannot be determined by static analysis.
  • Static analysis tools inevitably return 'don't know' for undecidable properties, leading to false positives or false negatives unless sophisticated approximation techniques are used.
  • The absolute ban on effectless code (e.g., MISRA C:2012 Rule 2.2) is practically unenforceable and leads to unavoidable deviations, even in high-integrity projects.
  • A proposed alternative directive—'Unjustified effectless code shall be minimized'—provides a more realistic and maintainable approach by focusing on code quality and intent rather than absolute elimination.
  • Decidable approximations can be implemented for many undecidable guidelines, especially when combined with peer review, testing, and documentation, improving tool reliability without sacrificing safety.
  • The Linux kernel community’s growing acceptance of stricter coding rules suggests a shift toward more disciplined, safety-oriented practices, even in less-regulated environments.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.