GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gcc

Return early in callback_only attribute handler if not used on function

Fixes an ICE in the callback_only attribute handler by adding an early return for non-function targets.

An Internal Compiler Error (ICE) in GCC’s callback_only attribute handler has been fixed by adding a missing return statement. This ensures the handler correctly exits when the attribute is not applied to a function, preventing issues that arose after the introduction of positional_argument handling.

In Details

The handle_callback_only_attribute function in c-attribs.cc lacked an early return for cases where the attribute was applied to entities other than functions. This commit adds that check, preventing an ICE that would occur when positional_argument was subsequently processed, as the attribute handler's state would be inconsistent.

For Context
callback_only attribute
A function attribute that signifies certain restrictions or properties of functions intended to be used as callbacks. The exact implications depend on the context in which it's applied within the compiler.
Internal Compiler Error (ICE)
An unrecoverable error within the compiler itself, indicating a bug in the compiler's logic or internal data structures. The build process is halted.
c-attribs.cc
A GCC source file containing the implementation for handling various C language attributes.
positional_argument
A concept within GCC related to function attributes, likely referring to how arguments are passed or how attributes are applied positionally rather than by name.
Filed Under: bugfixattributecompiler-error