← All stories
● Covered by 1 source · 1 reportMedium impact1 neutral

GCC 16 Guarantees Trampoline-Free Nested Functions Without Parent Context Access

🔄 Updated 22h ago
New to BrevFeed? We gather this story from every outlet covering it into one summary — ranked by real-world impact, not just the latest headline — so you never miss what matters. What is BrevFeed? →

Key points

  • GCC 16 guarantees trampoline-free nested functions if no parent variables are accessed.
  • This improves security by removing the need for an executable stack.
  • A patch for new built-in functions for wide pointers was merged into GCC development.
  • These functions aim to handle parent context access without trampolines.

Trampoline-Free Nested Functions in GCC 16

GCC 16 ensures that nested functions that do not access variables from their parent function will not require a run-time trampoline. This behavior was previously observed during optimization but is now guaranteed and documented, even without optimization. This change allows such functions to be safely returned from their parent and introduces warnings when attempting to return functions that access local context in simple cases.

Security Implications

The elimination of trampolines for certain nested functions addresses a security concern. Traditionally, trampolines were placed on the stack, necessitating an executable stack. A non-executable stack is a significant security feature, and this update helps maintain that security by reducing instances where an executable stack might be required. While GCC previously offered placing trampolines on the heap, this was not ideal due to higher allocation costs and potential leaks with `longjmp`.

New Built-in Functions for Wide Pointers

A patch implementing two new built-in functions has been merged into the development branch of GCC. These functions are designed to work with existing built-in `__builtin_call` and aim to improve how nested functions can access variables of their parent function without relying on trampolines. This development is part of an ongoing effort to enhance the utility and safety of nested functions in GCC.

Context Access and Callback Functions

Nested functions that do not access parent variables can still access static variables, named constants, or types (if not variably modified). This capability is useful for writing callback functions. The new built-in functions are intended to provide a more direct and compiler-supported method for nested functions to access parent context, moving beyond manual boilerplate solutions.

✨ This summary was generated by AI from the outlets' reporting listed below. It is not independently verified and may contain errors — check the original sources. How BrevFeed works →

The daily brief

One email each morning: the day's tech stories, clustered across outlets and summarized. No account needed.

One email a day. Unsubscribe in one click, any time.

Today's brief

Spend a few minutes, get the whole day. Every topic's top stories in one hands-free rundown — listen, watch, or read the transcript.

~7 min · 6 stories · Aug 15

▶ Play today's brief Listen on Spotify

New every morning, and the back catalogue is archived by date.

Reporting from

GCC 16 guarantees that nested functions not accessing parent variables will not require run-time trampolines, enhancing security by removing the need for an executable stack. Additionally, a patch implementing new built-in functions for wide pointers in nested functions was merged into GCC's development branch, aiming to improve how nested functions handle parent context access without trampolines.