Checking Compatibility of Bit Sizes in Floating Point Comparison Operations

  • Manuel Fahndrich ,
  • Francesco Logozzo

Proceedings of the 3rd workshop on Numerical and Symbolic Abstract Domains |

Published by Electronic Proceedings in Theoretical Computer Science

We motivate, define and design a simple static analysis to check that comparisons of floating point values use compatible bit widths and thus compatible precision ranges. Precision mismatches arise due to the difference in bit widths of processor internal floating point registers (typically 80 or 64 bits) and their corresponding widths when stored in memory (64 or 32 bits). The analysis gurantees that floating point values from memory (i.e. array elements, instance and static fields) are not compared against floating point numbers in registers (i.e. arguments or locals).

Without such an analysis, static symbolic verification is unsound and hence may report false negatives.

The static analysis is fully implemented in Clousot, our static contract checker based on abstract interpretation.