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

Fix IPA callback edges without carrying edges in call site hash.

Ensures internal IPA callback edges are correctly hashed when they lack a carrying edge.

This patch resolves an issue in the Interprocedural Analysis (IPA) call graph construction where internal callback edges, which lack a carrying edge, were not being correctly added to the call_site_hash. Previously, an early return condition intended for regular callback edges incorrectly skipped these internal ones. This led to segfaults in scenarios like PR128226 because the call_site_hash construction would be incomplete. The fix modifies the condition to only skip callback edges that possess a carrying edge.

In Details

The commit modifies cgraph.cc's cgraph_add_edge_to_call_site_hash to correct the handling of internal callback edges in IPA. These edges, unlike regular callbacks, do not have an associated 'carrying edge'. The original early return logic, designed to favor hashing carrying edges for regular callbacks, inadvertently skipped these internal callbacks when they were among the first 100 edges considered. This fix ensures that the early return only applies to callback edges that *do* have a carrying edge, allowing internal callback edges to be correctly hashed, thus preventing segfaults report…

For Context
IPA
Interprocedural Analysis. A compiler analysis technique that examines calls between different functions to optimize code more effectively than analyzing functions in isolation.
callback edge
In the context of call graphs, a callback edge represents a call from a callee back to a caller, often occurring in scenarios like event handling or indirect function calls. It's a specific type of edge within the call graph structure.
carrying edge
An edge in the call graph that represents a direct function call, as opposed to an indirect or callback edge. It is used in IPA to help distinguish different call sites.
call_site_hash
A data structure or mechanism used within the IPA framework to efficiently manage and identify distinct call sites. It helps in distinguishing between different places where a function can be called, which is crucial for precise interprocedural analysis.
call graph
A directed graph representing the calling conventions between subroutines or functions in a computer program. Nodes represent functions, and edges represent calls from one function to another.
Filed Under: ipacallgraphoptimizationbugfix