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

Fix debug info for bit-packed Ada arrays with reverse storage order

Correct debug information is now generated for bit-packed Ada arrays using reverse storage order.

GCC generated incorrect debug information for Ada bit-packed array types when they used a reverse storage order. These types are internally represented as modular integer types, and the debug info lacked accurate information about their storage arrangement. This commit introduces a reverse_storage_order field to the array_descr_info structure and ensures it is correctly populated by the Ada front-end, fixing the debug info inaccuracies.

In Details

Bit-packed array types in Ada, when small, are represented internally as modular integer types. The DWARF debug info generation for these types was incorrect when the reverse_storage_order attribute was set on the underlying array type. The dwarf2out.cc's gen_descr_array_type_die function was not using the correct information from the LANG_HOOKS_GET_ARRAY_DESCR_INFO hook. This fix adds a reverse_storage_order field to struct array_descr_info and ensures the Ada front-end (gnat_get_array_descr_info) correctly sets this field based on TYPE_REVERSE_STORAGE_ORDER of the array type…

For Context
Ada
A high-level, statically and strongly typed programming language, designed for systems programming and large, long-lived applications where reliability and efficiency are critical.
bit-packed
A data structure or type where individual bits are packed tightly together, rather than occupying full bytes or words, to save memory space. This is common for representing flags or small enumerated values.
reverse storage order
A memory layout option where the least significant byte of a multi-byte value is stored at the highest memory address, and the most significant byte is at the lowest memory address. This is the opposite of the more common little-endian or big-endian conventions.
DWARF
A debugging data format used by many compilers and debuggers to store information about program variables, types, and execution flow, enabling symbolic debugging.
modular integer type
An integer type that represents values within a specific range, typically modulo some number. For example, an 8-bit unsigned integer is effectively a modular integer type modulo 256.
LANG_HOOKS_GET_ARRAY_DESCR_INFO
A language-specific hook mechanism in GCC that front-ends can implement to provide detailed information about array types to the common backend, particularly for debug info generation.
Filed Under: gccadadebuginfobugfix