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

Codeview avoids retaining released function objects.

Fixes an ICE in CodeView generation by storing function DIEs and definition numbers instead of pointers to released function objects.

An Internal Compiler Error (ICE) in CodeView generation occurred because function objects were retained and dereferenced after being released by the cgraph component. This commit resolves the issue by storing the DIE and function definition number instead of the direct function object pointer. This ensures consistent hashing and lookups, preventing the ICE and improving the reliability of debug information generation for functions.

In Details

The codeview_function and related functions in dwarf2codeview.cc were retaining cfun pointers after cgraph released them. This led to a use-after-free vulnerability and an ICE when cv_func_hasher attempted to access a dereferenced cfun for later functions. The fix replaces the cfun pointer with a DIE and funcdef_no pair, and updates the hashing and equality checks to use these stored values, ensuring correct function identification without dangling pointers.

For Context
DIE
Debugging Information Entry. A structured record within DWARF or CodeView debug data that describes a program element like a variable, type, or function.
ICE
Internal Compiler Error. An unrecoverable error encountered by the compiler during compilation, typically indicating a bug in the compiler itself.
cgraph
The GCC internal component responsible for call graph analysis and function outlining, managing function-level compilation.
Filed Under: debugcodeviewcompiler bug