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

Fix initialization of modified flag in IPA parameter adjustments

Corrected initialization logic for function type modifications in IPA pass, resolving issues with attribute dropping.

This patch fixes an issue in the Inter Procedural Analysis (IPA) pass where the modified flag in build_new_function_type was not initialized correctly. This incorrect initialization could lead to attributes not being dropped when they should have been, causing problems like those reported in PR128602. The fix ensures that both cases—parameters being removed and functions initially having no parameters—are handled properly, leading to more accurate attribute management.

In Details

The ipa_param_adjustments::build_new_function_type function's modified flag initialization has been corrected. Previously, when m_adj_params was NULL, modified could be set incorrectly, either missing a change when parameters were removed or incorrectly indicating a change when no parameters existed initially. This led to incorrect attribute propagation, as seen in PR128602 where attributes like noreturn or visibility were not dropped when function signatures were altered by IPA transformations. The fix ensures modified accurately reflects whether the function type's parameter lis…

For Context
IPA
Inter-Procedural Analysis. A compiler optimization phase that analyzes and optimizes code across function boundaries, rather than within a single function.
pass
A distinct stage or transformation within the compiler's optimization pipeline. Each pass performs a specific analysis or transformation on the intermediate representation of the code.
function type
A type that describes a function, including its return type and the types and number of its parameters.
attribute
Metadata attached to functions or variables that provides hints or constraints to the compiler, influencing optimization or code generation (e.g., noreturn, visibility).
Filed Under: optimizationcompiler