GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gcc

Range check now verifies the supplied range type.

Fixed an incorrect range check in get_tree_range that checked the value_range, not the supplied range type.

The get_tree_range function now correctly checks if the supplied vrange supports the expression type, rather than incorrectly checking the value_range. This ensures that the range check accurately reflects the supported types, preventing potential errors in subsequent code transformations.

In Details

GCC's value range propagation tracks the possible range of values that a variable or expression can take at runtime. The code in value-query.cc provides an interface for querying these value ranges. get_tree_range retrieves the value range for a given expression tree. This commit fixes a bug where the code was checking the wrong range during the type check. value_range and vrange are likely internal data structures used to represent value ranges in GCC.

For Context

Compilers often track the range of values that a variable can hold. This information is used to perform optimizations such as dead code elimination or to detect potential overflows. This commit fixes a bug in GCC's range checking logic. The get_tree_range function retrieves the range of possible values for a given expression. The fix ensures the correct range is checked against the expression's type, preventing potential errors during optimization.

Filed Under: gccrange analysisbugfix