Abstract

We present a semantics of a significant fragment of the C programming language as described by the C11 standard. It consists of a small step semantics of a core language, which uses a structured memory model to capture subtleties of C11, such as strict-aliasing restrictions related to unions, that have not yet been addressed by others. The semantics of actual C programs is defined by translation into this core language. We have an explicit type system for the core language, and prove type preservation and progress, as well as type correctness of the translation.

Highlights

  • Many programs need a high runtime performance, close control of the underlying hardware, to be able to run with a minimal runtime environment, or to be very portable

  • To explore all defined and undefined behaviors, we present an executable semantics that computes a stream of finite sets of reachable states

  • We extend the language with a type system and prove that the operational semantics enjoys type presentations and progress

Read more

Summary

Introduction

Many programs need a high runtime performance, close control of the underlying hardware, to be able to run with a minimal runtime environment, or to be very portable. As well as in ours, there is a formal description of a significant part of C close to the C11 standard and an executable interpreter that matches the semantics precisely There has been a lot of related work on tool support for writing definitions of programming languages which can be automatically translated to different proof assistants. We integrate our new memory model that supports array, struct, and union types [13, 15] As usual, such integration suffers from feature interaction leading to many changes to the operational semantics (like introducing new language constructs), as well as the memory model (like extending the permission system). All details can be found online at: http://robbertkrebbers.nl/research/ch2o/

Challenges
Section 7
Sequence point violations and non-determinism
Non-local control and block scope variables
Indeterminate memory and pointers
Effective types and aliasing restrictions
Type-punning
Byte-level operations
Arithmetic conversions and overflow
Operational semantics of CH2O core C
Notations
Memory model
Expression semantics
Whole programs semantics
Type system of CH2O core C
Executable semantics of CH2O core C
Weakening
CH2O abstract C
Testing the semantics
Implementation and formalization in Coq
Conclusion
Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call