GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
reg-stack

reg-stack rejects asm operands needing multiple stack registers

The register stack pass now rejects inline assembly operands that require more than one x87 stack register.

The reg-stack optimization pass now correctly rejects inline assembly operands that require multiple x87 stack registers. Previously, complex operands like long double or float _Complex could lead to incorrect register tracking and assertion failures. This change enforces the limitation that each asm operand must occupy a single register, improving robustness and preventing crashes.

In Details

The reg-stack pass manages x87 FPU stack registers (ST(0) through ST(7)). When processing inline assembly operands, it now explicitly checks if an operand requires more than one stack register (e.g., complex types occupying ST(0) and ST(1)). Such operands are now rejected with an error, preventing mismatches between the expected stack state before and after the asm block and avoiding assertion failures in convert_regs_1.

For Context
reg-stack
A GCC optimization pass that manages the use of x87 FPU stack registers, allowing them to be treated more like general-purpose registers where possible.
asm operand
A value passed into or out of an inline assembly statement. The compiler must ensure these values are correctly available in registers before and after the assembly code executes.
x87 stack registers
The eight registers (ST(0) to ST(7)) on the x86 FPU that operate in a stack-like manner for floating-point operations.
long double
A C data type representing a floating-point number with potentially higher precision than double. On x86, it typically uses 80-bit extended-precision format occupying two stack registers.
float _Complex
A C complex number type where both the real and imaginary parts are float. This typically requires two registers to store.
death note
A compiler internal annotation indicating that a register should not be live after a certain point, often used in conjunction with inline assembly to manage register state.
Filed Under: x86asmregister allocation