GCC Newspaper
NOVEMBER 30, 2026
gcc — Proposed — Sentiment 5 / 10

GCC 15 and 16 regression causes frame memory leaks

A regression in GCC 15 and 16 causes memory leaks in programs compiled with the latest versions.

Ahmed Gheith reports a memory leak occurring in GCC 15 and 16 that is not present in GCC 14. The issue appears to stem from a change in how atomic subtract operations are handled, switching from atomic to non-atomic operations. This regression impacts programs using C++23 features and threading.

In the Thread 3 participants
  1. Gheith, Ahmed proposer

    Reports a memory leak in GCC 15 and 16 compared to GCC 14, linking it to a change from atomic to non-atomic operations for subtract.

    “The attached program works as expected when compiled with g++ 14 but reports leaks with both g++ 15 and 16. Visual inspection of the generated code suggests that it’s related to replace an atomic sub in g++ 14 with a non-atomic one in g++ 15.”
  2. Jonathan Wakely reviewer

    Requests the reporter to file a bug report on the official GCC bug tracking system.

    “Please report this to https://gcc.gnu.org/bugzilla - thanks”
  3. Torbjorn SVENSSON other

    Acknowledges Jonathan Wakely's request to report the issue on Bugzilla.

Technical Tradeoffs

  • Potential performance degradation due to incorrect atomic operation handling.
  • Increased memory consumption leading to program instability.

In Details

A regression in GCC's C++ frontend for versions 15 and 16 has been identified, manifesting as a frame memory leak. The issue appears to be related to the optimization of atomic operations, specifically a change from atomic to non-atomic subtract operations. This impacts code that uses threading and potentially other concurrency primitives.

Filed Under: gccregressionmemory leakc++atomic operations