Landing: ce88ece514dc
Project / Subsystem
gcc / ipa-icf
Date
2026-08-15
Author
Rohith Kapelli
Commit
ce88ece514dcedd41fb9d28943ad37b927ec5621
Source
github
Perf win
No
Breaking
No
All attributes
- project
- gcc
- subsystem
- ipa-icf
- patch_id
- —
- commit_hash
- ce88ece514dcedd41fb9d28943ad37b927ec5621
- source_type
- github
- headline
- ICF now checks function non-null contracts to prevent incorrect merging.
- tldr
- Inter-Function Cloning (ICF) now correctly compares function non-null argument contracts, preventing it from merging functions with differing promises and caus…
- author
- Rohith Kapelli
- outcome
- committed
- performance_win
- false
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • optimization
- • IPA
- • compiler
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-08-15T00:00:00.000Z
This commit fixes a bug in GCC’s Inter-Function Cloning (ICF) pass where it failed to consider the non-null contract promises of functions. Previously, ICF could merge identical function bodies even if they made different guarantees about their arguments’ non-nullability. This could lead to a function with a strict non-null promise being unified with one that accepts nulls, subsequently causing a null pointer dereference when called via the latter symbol. The changes ensure that ICF correctly compares function type attributes and differentiates between METHOD_TYPE and FUNCTION_TYPE to prevent such dangerous merges.