Analyzer gains arbitrary-precision integer class
New integer classes for the analyzer's state tracking will improve type safety and support arbitrary precision.
The GCC analyzer has gained a new arbitrary-precision integer class that wraps libgmp’s mpz_t. This forms the basis for a new unit-safe integer type that captures units like bits or bytes in the type system, preventing mismatches at compile time. Additionally, a concrete range class for these integers has been introduced. While not yet used, these foundational classes are intended to support an upcoming rewrite of the analyzer’s state-tracking logic.
In Details
The GCC analyzer is introducing new C++ classes in analyzer/integer.h, analyzer/integer-with-unit.h, and analyzer/concrete-ranges.h. These leverage libgmp for arbitrary-precision arithmetic and aim to improve type safety and range tracking within the analyzer's state representation, particularly for upcoming rewrites targeting concretely-known endpoints.
- arbitrary-precision integer
- An integer type that can store integers of any size, limited only by available memory, unlike fixed-size types (e.g., int32, int64).
- GCC analyzer
- A static analysis component within GCC that inspects code without executing it, aiming to find bugs and provide information about program behavior.
- type safety
- A property of programming languages where the type system prevents operations that are not well-defined for the given types, reducing runtime errors.