GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gcc

Fix static initializer for _Float16 with reverse storage order

Corrects static initializer handling for _Float16 in reverse storage order to support smaller than 4-byte floating-point modes.

This commit addresses an issue with static initializers for _Float16 when using reverse storage order. The existing assemble_real function in the varasm.cc file did not properly handle floating-point modes smaller than 4 bytes in this specific order. The fix modifies the reverse storage order code path to correctly manage these smaller floating-point types, ensuring accurate initialization.

In Details

The assemble_real function in varasm.cc had a bug in its reverse storage order code path, failing to correctly handle floating-point modes smaller than 4 bytes (e.g., _Float16). This commit updates this code path to accommodate these smaller modes, resolving issues with static initializers for _Float16 when reverse storage order is employed. A new test, gcc.dg/sso-22.c, is added.

For Context
_Float16
A GCC extension representing the IEEE 754-2008 binary16 floating-point format, which uses 16 bits.
static initializer
A value used to initialize a global or static variable when the program starts. The compiler must correctly generate code to set these initial values.
reverse storage order
A data layout or serialization method where multi-byte values are stored or processed with the least significant byte first (little-endian) or most significant byte first (big-endian) in a specific order. In this context, it refers to how floating-point values are assembled for initialization.
floating-point modes
Representations of floating-point numbers within the compiler, differing in precision and format (e.g., single-precision float, double-precision double, or half-precision _Float16).
Filed Under: optimizationfloating-pointbugfix