• Corpus ID: 15412934

Subtleties of the ANSI / ISO C standard

@inproceedings{Krebbers2012SubtletiesOT,
  title={Subtleties of the ANSI / ISO C standard},
  author={Robbert Krebbers and Freek Wiedijk},
  year={2012}
}
In our Formalin project to formalize C11 (the ANSI/ISO standard of the C programming language) we discovered many subtleties that make formalization of this standard difficult. We discuss some of these subtleties and indicate how they may be addressed in a formal C semantics. Furthermore, we argue that the C standard does not allow Turing complete implementations, and that its evaluation semantics does not preserve typing. Finally, we claim that no strictly conforming programs exist. That is… 

Figures from this paper

Towards optimization-safe systems
TLDR
A novel model is proposed, which views unstable code as optimizations that are valid only under the assumption that the program is well-defined, and introduces a new static checker called Stack that precisely identifies unstable code.
A differential approach to undefined behavior detection
  • Xi Wang
  • Computer Science
    Commun. ACM
  • 2014
TLDR
A new static checker called STACK is introduced that precisely identifies undefined behavior bugs in systems programming languages such as C/C++ by finding "unstable code" in terms of optimizations that leverage undefined behavior.
Hyperkernel: Push-Button Verification of an OS Kernel
TLDR
Experience shows that Hyperkernel can avoid bugs similar to those found in xv6, and that the verification of Hyper kernel can be achieved with a low proof burden.
Towards optimization-safe systems: analyzing the impact of undefined behavior
TLDR
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.
ISO / IEC JTC 1 / SC 22 / WG 14 N 2311 , 2018-1109 Exploring C Semantics and Pointer Provenance
TLDR
This paper aims to reconcile the ISO C standard, mainstream compiler behaviour, and the semantics relied on by the corpus of existing C code, and presents two coherent proposals, tracking provenance via integers and not; both address many design questions.
Exploring C semantics and pointer provenance
TLDR
This paper aims to reconcile the ISO C standard, mainstream compiler behaviour, and the semantics relied on by the corpus of existing C code, and presents two coherent proposals, tracking provenance via integers and not; both address many design questions.
C provenance semantics: examples
TLDR
The design of provenance semantics for C is discussed, looking at a series of examples of Exploring C Semantics and Pointer Provenance and also the provenance-via-integers (PVI) model.

References

SHOWING 1-10 OF 27 REFERENCES
A Formalization of the C99 Standard in HOL, Isabelle and Coq
TLDR
The Formalin project to create a formal version of the C99 standard for the C programming language, which means that the C preprocessor, the C standard library, floating point arithmetic, and 'dirty' C features like signal handling and volatile variables are treated.
Mechanized Semantics for the Clight Subset of the C Language
TLDR
The formal semantics of a large subset of the C language called Clight is presented, which includes pointer arithmetic, struct and union types, C loops and structured switch statements, and is mechanized using the Coq proof assistant.
A Formal Semantics for the C Programming Language
TLDR
A formal denotational semantics for the ANSI C programming language is proposed, with emphasis on its accuracy and completeness with respect to the standard, and is demonstrated that a programming language as useful in practice and as inherently complicated as C can nonetheless be defined formally.
An executable formal semantics of C with applications
TLDR
The semantics is shown capable of automatically finding program errors, both statically and at runtime, and it is also used to enumerate nondeterministic behavior.
seL4: formal verification of an OS kernel
TLDR
To the knowledge, this is the first formal proof of functional correctness of a complete, general-purpose operating-system kernel.
Undefined behavior: what happened to my code?
TLDR
It is argued that the research community should help address the problems that arise from undefined behavior, and not dismiss them as esoteric C implementation issues, because they do happen in real-world systems.
Formal Verification of a C-like Memory Model and Its Uses for Verifying Program Transformations
TLDR
This article presents the formal verification, using the Coq proof assistant, of a memory model for low-level imperative languages such as C and compiler intermediate languages that supports reasoning over transformations of such programs.
VCC: A Practical System for Verifying Concurrent C
TLDR
This paper motivates VCC, describes the verification methodology, the architecture of VCC is described, and the experience using VCC to verify the Microsoft Hyper-V hypervisor is reported on.
Compiler verification in the context of pervasive system verification
This thesis presents the formal verification of the compiling specification for a simple, non-optimizing compiler from the C-like programming language C0 to VAMP assembly code. The main result is a
Finding and understanding bugs in C compilers
TLDR
Csmith, a randomized test-case generation tool, is created and spent three years using it to find compiler bugs, and a collection of qualitative and quantitative results about the bugs it found are presented.
...
...