scispace - formally typeset
Open Access

An Executable Formal Semantics of C with Applications: Technical Report

TLDR
In this paper, the authors present an executable formal semantics of C. The semantics yields an interpreter, debugger, state space search tool, and model checker, which is shown capable of automatically finding program errors, both statically and at runtime.
Abstract
This paper describes an executable formal semantics of C. Being executable, the semantics has been thoroughly tested against the GCC torture test suite and successfully passes 770 of 776 test programs. It is the most complete and thoroughly tested formal definition of C to date. The semantics yields an interpreter, debugger, state space search tool, and model checker “for free”. The semantics is shown capable of automatically finding program errors, both statically and at runtime. It is also used to enumerate nondeterministic behavior.

read more

Citations
More filters
Proceedings ArticleDOI

Compiler validation via equivalence modulo inputs

TL;DR: This work introduces equivalence modulo inputs (EMI), a simple, widely applicable methodology for validating optimizing compilers, and profiles a program's test executions and stochastically prune its unexecuted code to create a practical implementation.
Proceedings ArticleDOI

KEVM: A Complete Formal Semantics of the Ethereum Virtual Machine

TL;DR: KEVM is presented, an executable formal specification of the EVM's bytecode stack-based language built with the K Framework, designed to serve as a solid foundation for further formal analyses and to demonstrate the usability of the semantics.
Proceedings ArticleDOI

Test-case reduction for C compiler bugs

TL;DR: It is concluded that effective program reduction requires more than straightforward delta debugging, so three new, domain-specific test-case reducers are designed and implemented based on a novel framework in which a generic fixpoint computation invokes modular transformations that perform reduction operations.
Proceedings ArticleDOI

K-Java: A Complete Semantics of Java

TL;DR: K-Java is presented, a complete executable formal semantics of Java 1.4 that is applied to model-check multi-threaded programs and is generic and ready to be used in other Java-related projects.
Proceedings ArticleDOI

Towards optimization-safe systems: analyzing the impact of undefined behavior

TL;DR: A novel model is proposed, which views unstable code in terms of optimizations that leverage undefined behavior, and a new static checker called Stack is introduced that precisely identifies unstable code.
References
More filters
Book ChapterDOI

A framework for modeling the semantics of expression evaluation with abstract state machines

TL;DR: This work presents a framework for formalizing the semantics of expression evaluation using Abstract State Machines, and provides a generic expression evaluation semantics that only need to be instantiated adequatly.
Journal ArticleDOI

A study of evaluation order semantics in expressions with side effects

TL;DR: This paper adopts a dialect of Haskell as a metalanguage, instead of mathematical notation, and uses monads and monad transformers to improve modularity, resulting in a better understanding of different evaluation strategies and a unified way of specifying their semantics.
Book

C Programming Faqs: Frequently Asked Questions

Steve Summit
TL;DR: This chapter discusses Declarations and Initializations, Arrays and Pointers, Functions and Multidimensional Arrays, Structures, Unions, and Enumerations, and Structure Declarations, and C Preprocessor Features.
Related Papers (5)