Formal verification of a realistic compiler
Xavier Leroy CACM 2009
CS 7194: Great Works in Programming Languages Presenter : Irene Yoon | Mentor : Ryan Doenges
- 1
Formal verification of a realistic compiler Xavier Leroy CACM 2009 - - PowerPoint PPT Presentation
Formal verification of a realistic compiler Xavier Leroy CACM 2009 CS 7194: Great Works in Programming Languages Presenter : Irene Yoon | Mentor : Ryan Doenges 1 Building robust compilers is Hard. 2 Bugs bugs 3 Bugs [Yang
Xavier Leroy CACM 2009
CS 7194: Great Works in Programming Languages Presenter : Irene Yoon | Mentor : Ryan Doenges
2
3
bugs
4
[Yang et al 2011]
5
[Yang et al 2011]
6
[Yang et al 2011]
7
[Yang et al 2011]
✅ Building compilers is hard Testing sucks Formalisms are good
8
✅ Building compilers is hard ✅ Testing sucks Formalisms are good
9
✅ Building compilers is hard ✅ Testing sucks ✅ Formalisms are good
10
✅ Building compilers is hard ✅ Testing sucks ✅ Formalisms are good
11
12
[1967]
13
[1972]
14
15
16
17
[2003]
18
“Develop and prove correct a realistic compiler, usable for critical embedded software.”
Clight PowerPC ARM x86
source target CompCert [2009]
“Develop and prove correct a realistic compiler, usable for critical embedded software.”
Clight PowerPC ARM x86
source target CompCert [2009]
“Develop and prove correct a realistic compiler, usable for critical embedded software.”
Clight PowerPC ARM x86
source target CompCert [2009]
22
23
COMPILER
source target
2 . Translation validation [Translation Verification]
24
COMPILER
source
VALIDATOR
target
25
PROOF CHECKER CERTIFYING COMPILER
source target code + certificate
26
27
[Leroy `06]
28
=> External solver with verified validation
29
[Tristan and Leroy `10]
=> External solver with verified validation
30
31
formal specification
32
→ semantic analysis tools [Appel ’11]
formal specification
33
semantic preservation*
34
35
36
37
Compiled code C preserves the fact that the source code S satisfies the specification.
38
39
40
*
if program is “safe” (no runtime errors)
41
if program is “safe” (no runtime errors)
42
43
44
45
46
47
48
49
50
51
52
competitive with gcc -01
53
54
[Yang et al 2011]
and model of machine)
“The striking thing about our CompCert results is that the middle-end bugs we found in all other compilers are absent”
55
[Yang et al 2011]
and model of machine)
“The striking thing about our CompCert results is that the middle-end bugs we found in all other compilers are absent”
56
[Yang et al 2011]
and model of machine)
“The striking thing about our CompCert results is that the middle-end bugs we found in all other compilers are absent”
57
[Yang et al 2011]
and model of machine)
“The striking thing about our CompCert results is that the middle-end bugs we found in all other compilers are absent”
et al, ’17]
58
et al, ’17]
59
et al, ’17]
60
et al, ’17]
61
et al, ’17]
62
“a realistic compiler”
63
. . .
64
. . .
. . .
65
. . .
66
. . .
Type Preserving Compilation
. . .
. . .
67
Type Preserving Compilation
68