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

dwarf2out: Allow for an empty cie_cfi_vec.

Fixes DWARF output for platforms without CFI instructions by handling an empty call frame information vector.

This commit modifies the DWARF output generation to safely handle cases where the call frame information vector (cie_cfi_vec) is empty. This can occur when the RTL front end starts processing at a later pass, or on platforms that do not utilize CFI (Common Frame Interface) instructions. The change prevents potential crashes or errors by checking if the vector is unset before attempting to iterate over it in output_call_frame_info.

In Details

In GCC's DWARF output generator (dwarf2out.cc), the output_call_frame_info function iterates over cie_cfi_vec to output Call Frame Information (CFI) data. This commit addresses a scenario where the RTL front end might be invoked after the initial setup of cie_cfi_vec, or on targets where CFI instructions are not used, potentially leaving cie_cfi_vec unset or empty. The change adds a check for !cie_cfi_vec before the loop, ensuring that the function gracefully handles platforms that don't generate or require CFI data, preventing issues particularly with RTL test cases.

For Context
DWARF
A standard debugging data format used by many compilers, including GCC. It provides information about variables, types, scopes, and line numbers, enabling debuggers to interpret program execution.
dwarf2out
The GCC component responsible for generating DWARF debugging information.
CFI
Common Frame Interface. A standard for describing the layout of stack frames, used in DWARF to represent function call stack unwinding information. This allows debuggers to trace function calls and returns.
RTL
Register Transfer Language. An intermediate representation used by GCC after the GIMPLE phase, closer to the machine code. It represents operations in terms of registers and memory accesses.
Call frame information
Information generated by the compiler that describes how to unwind the call stack, essential for debugging and profiling. It details the location of return addresses, saved registers, and local variables.
Filed Under: gccdwarfdebuggingbugfix