GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
tree-optimization

Fix bitfield vectorization with SSO for PR128414

Corrects bitfield vectorization by preventing the use of components with reverse storage order, fixing a miscompilation bug.

This commit resolves a miscompilation issue (PR tree-optimization/128414) related to vectorizing bitfields when Short-Stack Optimization (SSO) is involved. The fix prevents the lowering of bitfields that use components with a reverse storage order. A new test case is added to verify the correction.

In Details

This commit fixes PR tree-optimization/128414 by adding a check in bitfields_to_lower_p within tree-if-conv.cc. The check rejects components that have a reverse_storage_order set. This prevents incorrect vectorization of bitfields when they are laid out in memory in a way that the vectorizer's lowering pass does not handle properly, particularly when interacting with Short-Stack Optimization (SSO) related transformations that might expose such component orders.

For Context
bitfield
A field within a structure or union that occupies a specified number of bits, which may be less than the number of bits in a byte. Useful for packing data tightly.
vectorization
A compiler optimization technique that transforms loops to execute operations on multiple data elements in parallel using SIMD instructions.
SSO
Short-Stack Optimization. A compiler optimization that might involve using stack space more efficiently, potentially affecting how data is laid out or accessed.
miscompilation
A situation where a compiler produces incorrect output code for a given source program, leading to wrong program behavior at runtime.
storage order
The order in which bytes or bits of a data element are stored in memory. This can be affected by endianness and specific data structure layouts.
Filed Under: optimizationvectorizationbitfieldsbugfix