alpha: Decline __builtin_frame_address for nonzero counts.
Alpha architecture now correctly rejects calls to __builtin_frame_address with nonzero arguments, returning an error.
The Alpha architecture’s frame structure does not support accessing caller frames directly. This change modifies FRAME_ADDR_RTX to return an error for nonzero counts passed to __builtin_frame_address. This aligns with the architecture’s limitations, preventing the emission of incorrect text addresses and improving diagnostic messages.
In Details
On the Alpha architecture, stack frames lack a direct link to callers, making __builtin_frame_address(N) for N > 0 problematic. The generic implementation might return a valid text address but not a meaningful stack address. This commit hardcodes FRAME_ADDR_RTX on Alpha to decline non-zero arguments, returning 0 and an error message, which is more accurate than providing a potentially misleading address. This change also affects test cases like Wframe-address.c and Wno-frame-address.c.
- Alpha
- A discontinued 64-bit Reduced Instruction Set Computer (RISC) instruction set architecture developed by Digital Equipment Corporation (DEC).
- __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.
- 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.
- FRAME_ADDR_RTX
- A GCC target-specific macro used to determine the runtime address for
__builtin_frame_address. - RTX
- Representation Tree, an internal data structure used by GCC to represent code during optimization.