Analyzing Compliance with Safety Standards in C Code via Large Language Models
Ensuring code compliance with safety standards such as MISRA C:2012 is essential for the development of reliable and secure embedded systems in domains like automotive software. Traditional compliance checks rely on rule-based static analyzers, but recent advances in large language models (LLMs) suggest potential for automating such tasks. This paper investigates the zero-shot capabilities of four general-purpose LLMs, such as GPT-4o, LLaMA 3.1, O3-mini, and Mixtral, in identifying violations of 20 undecidable MISRA C:2012 rules. We build a private dataset annotated for MISRA compliance, used to evaluate LLMs under zero-shot prompting. While the data cannot be released, the methodology is generalizable and applicable to public codebases. Our findings show that while LLMs can correctly classify simple rule violations, they struggle with context-dependent rules. No single model excels across all categories, highlighting the need for rule-specific prompting strategies, multi-agent architectures or fine-tuning. These insights pave the way for more effective LLM-driven compliance tools tailored to high-assurance software development.
Authors
- Alexandru Guzu
- Georgian Nicolae (ORCID: https://orcid.org/0000-0001-7157-5387)
- Dorin Nuţeanu
Institutions
- Universitatea Națională de Știință și Tehnologie Politehnica București (RO)
Publication Details
- Published
- 2025-09-15
- DOI
- https://doi.org/10.1109/elmar66948.2025.11194021
- Primary Topic
- Safety Systems Engineering in Autonomy
- Type
- article
- Field-Weighted Citation Impact
- 0.00