Abstract
Floating-point arithmetic is known to be tricky: roundings, formats, exceptional values. The IEEE-754 standard was a push towards straightening the field and made formal reasoning about floating-point computations easier and flourishing. Unfortunately, this is not sufficient to guarantee the final result of a program, as several other actors are involved: programming language, compiler, and architecture. The CompCert formally-verified compiler provides a solution to this problem: this compiler comes with a mathematical specification of the semantics of its source language (a large subset of ISO C99) and target platforms (ARM, PowerPC, x86-SSE2), and with a proof that compilation preserves semantics. In this paper, we report on our recent success in formally specifying and proving correct CompCert’s compilation of floating-point arithmetic. Since CompCert is verified using the Coq proof assistant, this effort required a suitable Coq formalization of the IEEE-754 standard; we extended the Flocq library for this purpose. As a result, we obtain the first formally verified compiler that provably preserves the semantics of floating-point programs.
Similar content being viewed by others
Explore related subjects
Discover the latest articles, news and stories from top researchers in related subjects.References
Ayad, A., Marché, C.: Multi-prover verification of floating-point programs. In: Giesl, J., Hähnle, R. (eds.) 5th international joint conference on automated reasoning (IJCAR), Lecture Notes in Computer Science, vol. 6173. Springer, Edinburgh (2010)
Boldo, S.: Preuves formelles en arithmétiques à virgule flottante. Ph.D. thesis, École Normale Supérieure de Lyon (2004)
Boldo, S., Filliâtre, J.C.: Formal verification of floating-point programs. In: Kornerup, P., Muller, J.M. (eds.) 18th IEEE International symposium on computer arithmetic (ARITH). IEEE, pp. 187–194, Montpellier (2007)
Boldo, S., Melquiond, G.: Emulation of FMA and correctly-rounded sums: Proved algorithms using rounding to odd. IEEE Trans. Comput. 57(4), 462–471 (2008)
Boldo, S., Melquiond, G.: Flocq: A unified library for proving floating-point algorithms in Coq. In: Antelo, E., Hough, D., Ienne, P. (eds.) 20th IEEE symposium on computer arithmetic, pp. 243–252. IEEE, Tübingen (2011)
Boldo, S., Nguyen, T.M.T.: Proofs of numerical programs when the compiler optimizes. Innov. Syst. Softw. Eng. 7, 151–160 (2011)
Brisebarre, N., Muller, J.M., Raina, S.K.: Accelerating correctly rounded floating-point division when the divisor is known in advance. IEEE Trans. Comput. 53(8), 1069–1072 (2004)
Carreño, V.A., Miner, P.S.: Specification of the IEEE-854 floating-point standard in HOL and PVS In: 8th international workshop on higher-order logic theorem proving and its applications (HOL95), Aspen Grove, UT (1995)
Clinger, W.D.: How to read floating-point numbers accurately In: Programming language design and implementation (PLDI’90), pp. 92–101. ACM (1990)
Cousot, P., Cousot, R., Feret, J., Mauborgne, L., Miné, A., Monniaux, D., Rival, X.: The ASTRÉE analyzer In: 14th european symposium on programming (ESOP), Lecture Notes in Computer Science, vol. 3444, pp. 21–30. Springer, Berlin Heidelberg New York (2005)
Dekker, T.J.: A floating point technique for extending the available precision. Numerische Mathematik 18(3), 224–242 (1971)
Delmas, D., Goubault, E., Putot, S., Souyris, J., Tekkal, K., Védrine, F.: Towards an industrial use of FLUCTUAT on safety-critical avionics software In: Formal methods for industrial critical systems (FMICS), Lecture Notes in Computer Science, vol. 5825, pp. 53–69. Springer, Berlin Heidelberg New York (2009)
Figueroa, S.A.: When is double rounding innocuous?. SIGNUM Newsl. 30(3), 21–26 (1995)
Goldberg, D.: What every computer scientist should know about floating point arithmetic. ACM Comput. Surv. 23(1), 5–47 (1991)
Granlund, T., Montgomery, P.L.: Division by invariant integers using multiplication In: Programming language design and implementation (PLDI’94), pp. 61–72. ACM (1994)
Harrison, J.: A machine-checked theory of floating point arithmetic. In: Bertot, Y., Dowek, G., Hirschowitz, A., Paulin, C., Théry, L. (eds.) In: 12th International conference on theorem proving in higher order logics (TPHOLs’99), Lecture Notes in Computer Science, vol. 1690, pp. 113–130. Springer, Nice (1999)
Harrison, J.: Formal verification of floating point trigonometric functions In: 3rd International conference on formal methods in computer-aided design (FMCAD), Lecture Notes in Computer Science, vol. 1954, pp. 217–233. Springer, Austin (2000)
IBM: The PowerPC compiler writer’s guide. Warthman Associates (1996)
Ioualalen, A., Martel, M.: A new abstract domain for the representation of mathematically equivalent expressions In: 19th international symposium on static analysis, Lecture Notes in Computer Science, vol. 7460, pp. 75–93. Springer, Berlin Heidelberg New York (2012)
ISO: International standard ISO/IEC 9899:2011, Programming languages – C (2011)
Leavens, G.T.: Not a number of floating point problems. J. Object Technol. 5(2), 75–83 (2006)
Leroy, X.: Formal verification of a realistic compiler. Commun. ACM 52(7), 107–115 (2009)
Leroy, X.: The CompCert verified compiler, software and commented proof. Available at http://compcert.inria.fr/ (2014)
Li, G., Owens, S., Slind, K.: Structure of a proof-producing compiler for a subset of higher order logic. In: Nicola, R.D. (ed.) In: 16th european symposium on programming (ESOP), Lecture Notes in Computer Science, vol. 4421, pp. 205–219. Springer, Braga (2007)
Microprocessor Standards Subcommittee: IEEE Standard for Floating-Point Arithmetic. IEEE Std. 754-2008 pp. 1–58 (2008)
Milner, R., Weyhrauch, R.: Proving compiler correctness in a mechanized logic. In: Meltzer, B., Michie, D. (eds.) 7th annual machine intelligence workshop, Machine Intelligence, vol. 7, pp. 51–72. Edinburgh University Press (1972)
Monniaux, D.: The pitfalls of verifying floating-point computations. ACM Trans. Program. Lang. Syst. 30(3), 1–41 (2008)
Moore, J.S.: A mechanically verified language implementation. J. Autom. Reason. 5(4), 461–492 (1989)
Muller, J.M., Brisebarre, N., de Dinechin, F., Jeannerod, C.P., Lefèvre, V., Melquiond, G., Revol, N., Stehlé, D., Torres, S.: Handbook of floating-point arithmetic. Birkhäuser (2010)
Myreen, Magnus O.: Formal verification of machine-code programs. Ph.D. Thesis, University of Cambridge (2008)
Nguyen, T.M.T., Marché, C.: Hardware-dependent proofs of numerical programs. In: Jouannaud, J.P., Shao, Z. (eds.) International conference on certified programs and proofs (CPP), Lecture Notes in Computer Science, vol. 7086, pp. 314–329. Springer, Berlin Heidelberg New York (2011)
Nickolls, J., Dally, W.: The GPU computing era. IEEE Micro 30(2), 56–69 (2010)
Rump, S., Ogita, T., Oishi, S.: Accurate floating-point summation Part I: Faithful rounding. SIAM J. Sci. Comput. 31(1), 189–224 (2008)
Russinoff, D.M.: A mechanically checked proof of IEEE compliance of the floating point multiplication, division and square root algorithms of the AMD-K7 processor. LMS J. Comput. Math. 1, 148–200 (1998)
Sterbenz, P.H.: Floating point computation. Prentice Hall, Englewood Cliffs (1974)
Yang, X., Chen, Y., Eide, E., Regehr, J.: Finding and understanding bugs in C compilers In: 32nd ACM SIGPLAN conference on programming language design and implementation (PLDI), pp. 283–294. ACM Press (2011)
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
About this article
Cite this article
Boldo, S., Jourdan, JH., Leroy, X. et al. Verified Compilation of Floating-Point Computations. J Autom Reasoning 54, 135–163 (2015). https://doi.org/10.1007/s10817-014-9317-x
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10817-014-9317-x