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

Cgraph adjusted sanity checks for callback edges

Modifies cgraph's callback edge checks to accommodate internal callback edges and enable WPA checks.

This commit refactors sanity checks within GCC’s cgraph component related to callback edges. Previously, callback edges without a carrying edge were disallowed, but this restriction has been relaxed to include internal callback edges. The check has been moved to a different loop, allowing it to be performed in the Whole Program Analysis (WPA) context as well. This change ensures that internal callback edges are correctly validated and that the checks are consistently applied across different analysis stages.

In Details

The cgraph_node::verify_node function in cgraph.cc previously enforced that callback edges must have a carrying edge. This commit modifies this check to allow internal callback edges, which may not have a carrying edge in the same way. The code responsible for this check is moved to a different loop iteration, enabling it to be executed during WPA and ensuring consistency in how internal callback edges are validated throughout the analysis pipeline.

For Context
cgraph
Call Graph. A representation of the call relationships between functions in a program. GCC uses this to analyze and optimize call sites.
callback edge
An edge in the call graph that represents a function being called indirectly, often through a function pointer or a more complex mechanism. Internal callback edges are specific to GCC's internal representation.
carrying edge
An edge in the call graph that provides context or additional information for another edge, such as a callback edge. It helps to track the flow of control or data.
WPA
Whole Program Analysis. An analysis technique where the compiler examines the entire program at once to gather information for optimization, as opposed to analyzing procedures individually.
Filed Under: cgraphanalysiswpa