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

builtins: Pass frame count to FRAME_ADDR_RTX.

GCC's built-in functions now pass the frame count argument to target-specific FRAME_ADDR_RTX macros.

This change modifies GCC’s built-in function expansion to pass the frame count to the FRAME_ADDR_RTX macro. This allows target architectures to distinguish between requests for the current frame (depth 0) and deeper frames, enabling them to provide more accurate behavior or diagnostics when stack frame access is not supported.

In Details

The expand_builtin_frame_address function in GCC's builtins expansion was updated to pass the COUNT argument to the FRAME_ADDR_RTX macro. Previously, target implementations of FRAME_ADDR_RTX often ignored this argument. By passing COUNT, targets can now differentiate between requests for the current frame (COUNT == 0), which is always accessible, and requests for caller frames (COUNT > 0), for which they can provide specific handling or diagnostics if arbitrary stack frame access is not supported. This change affects several target-specific definitions of FRAME_ADDR_RTX.

For Context
__builtin_frame_address
A GCC built-in function that returns the stack address of the caller's frame. The argument specifies the frame depth relative to the current function.
FRAME_ADDR_RTX
A GCC target-specific macro used to determine the runtime address for __builtin_frame_address.
stack frame
A region of memory on the call stack allocated for a function call. It typically stores local variables, function arguments, and the return address.
RTX
Representation Tree, an internal data structure used by GCC to represent code during optimization.
NULL_RTX
A special RTX value used to indicate an error or an unsupported operation in GCC.
Filed Under: builtinsdebuggingcompiler