GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing compcert.org — CompCert - The CompCert C compiler CompCertcompilers you can formally trustThe CompCert C compilerCompCert C is a compiler for the C programming language. Its intended use is the compilation of life-critical and mission-critical software written in C and meeting high levels of assurance. It accepts most of the ISO C 99 language, with some exceptions and a few extensions. It produces machine code for the PowerPC, ARM, RISC-V and x86 (32 and 64 bits) architectures. Performance of the generated code is decent but not outstanding: on ARMv8, about 90% of the performance of GCC at optimization level 1. What sets CompCert C apart from any other production compiler, is that it is formally verified, using machine-assisted mathematical proofs, to be exempt from miscompilation issues. In other words, the executable code it produces is proved to behave exactly as specified by the semantics of the source C program. This level of confidence in the correctness of the compilation process is unprecedented and contributes to meeting the highest levels of software assurance. In particular, using the CompCert C compiler is a natural complement to applying formal verification techniques (static analysis, program proof, model checking) at the source code level: the correctness proof of CompCert C guarantees that all safety properties verified on the source code automatically hold as well for the generated executable. The subset of C supportedCompCert C supports all of ISO C 99, with the following exceptions:
Consequently, CompCert supports all of the MISRA-C 2004 subset of C, plus many features excluded by MISRA (such as recursive functions and dynamic heap memory allocation). A number of ISO C 2011 features are also supported:
CompCert also supports some extensions to ISO C taken from the GNU and Diab compilers:
Architecture of the compilerPart 1: Parsing, type-checking, and pre-simplifications.
This first part converts C source code into abstract syntax trees of the CompCert C language. Some constructs not natively supported by CompCert C are expanded away. For example, block-scoped local variables are renamed and lifted to function-local scope; and unstructured This part of CompCert (transformation of C source text to CompCert C
abstract syntax trees) is not formally verified. However, CompCert C is a
subset of C, and the compiler can output the generated
CompCert C code in C concrete syntax (flag Part 2: Compilation of CompCert C AST to assembly AST. This part is the bulk of the compiler and the one that is proved correct in Coq. It is structured in 16 passes and uses 10 intermediate language, as depicted on the following diagram.
All intermediate languages are given formal semantics, and each of the transformation passes is proved to preserve semantics. Part 3: Assembling and linking.
The abstract syntax tree for PowerPC or ARM or RISC-V or x86 assembly language
produced by part 2 is printed in concrete assembly syntax. The
system's assembler and linker are then called to produce object files
and executable files, respectively. This part is not yet formally
verified. A benefit of using the standard assembler and linker is
that object files produced by CompCert can be linked with existing
libraries compiled with Using the compilerThe executable for CompCert C is called ccomp -o exec src.c To compile a two-file program ccomp -c src1.c
ccomp -c src2.c
ccomp -o exec src1.o src2.o
To see the CompCert C code and the assembly code generated for
ccomp -dc -S src1.c The generated assembly code is left in file For more details, see the CompCert C user's manual. Performance of the generated codeOn PowerPC and ARM, the code generated by CompCert runs at least twice
as fast as the code generated by GCC without optimizations
(
(The sources for the test programs are available in the
|
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |