GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gcc/tree-optimization

Fix bitfield rounding in get_inner_reference_aff.

Correctly handles bitfield precision offsets and sizes for affine transformations.

The get_inner_reference_aff function has been corrected to properly handle bit precision offsets and sizes when calculating affine transformations. Previously, it failed to round these values correctly. This change adjusts the rounding logic to ensure more accurate computations, accompanied by a new test case to verify the fix.

In Details

The get_inner_reference_aff function in tree-affine.cc computes affine transformations, which are crucial for loop optimizations. This patch fixes a bug in how it handles bitfields, specifically the rounding of their sizes and positions. The corrected logic ensures that the precise bit-level offsets and sizes are accurately incorporated into the affine representation, preventing potential miscalculations in optimizations that rely on bitfield layouts.

For Context
affine transformation
A mathematical transformation that preserves lines and parallelism, often used in compiler optimizations to represent relationships between loop indices and memory accesses.
bitfield
A data structure within a C or C++ struct that allows for storage of integral types in a specified number of bits, less than the natural size of the type. This can save space but introduces complexities in accessing and calculating sizes.
Filed Under: optimizationcompiler