GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gcc

Fix `EXECUTE_IF_SET_IN_HARD_REG_SET` usage in `rtl-ssa/insns.cc`

GCC fixes a bug in how `EXECUTE_IF_SET_IN_HARD_REG_SET` is used, preventing incorrect register clobber handling during RTL SSA processing by explicitly managin…

GCC has corrected a subtle bug in rtl-ssa/insns.cc related to the EXECUTE_IF_SET_IN_HARD_REG_SET macro. The issue, reported as PR rtl-optimization/125609 and PR middle-end/122992, involved the macro being used with temporary variables whose lifetimes expired prematurely, leading to garbage values or deleted stores for register clobber information. The fix now explicitly stores the result of abi.full_reg_clobbers() into a variable, ensuring its lifetime extends throughout the macro’s execution and enabling correct register tracking.

In Details

The rtl-ssa pass in GCC is a crucial component of the compiler's intermediate representation that operates on Register Transfer Language (RTL) for optimization. This commit addresses an issue within rtl-ssa/insns.cc regarding the misuse of the EXECUTE_IF_SET_IN_HARD_REG_SET macro. The problem (PR125609, PR122992) stemmed from passing an rvalue (a temporary object returned by abi.full_reg_clobbers()) directly to the macro. The temporary's lifetime ended before the macro's internal loop completed, leading to undefined behavior or incorrect register clobber analysis for `function_info::r…

For Context

When a compiler like GCC translates your code, it goes through several internal stages. One of these stages uses something called Register Transfer Language (RTL), which describes how data moves between CPU registers. To optimize code efficiently, the compiler needs to know which registers are changed (or "clobbered") by function calls. This commit fixes a tricky bug in GCC's internal code that deals with tracking these register changes. Specifically, there was a problem with a special piece of compiler code (EXECUTE_IF_SET_IN_HARD_REG_SET) that was trying to use a temporary value that disappeared too soon. This could lead to the compiler incorrectly understanding which registers were affected by function calls, potentially causing incorrect or inefficient generated code. The fix ensures that this temporary value lasts long enough, so the compiler always has accurate information about register changes, leading to more reliable and correct compiled programs.

Filed Under: bugfixcompiler-internalsrtlregister-allocation