Landing: 219d9f4b006e

Project / Subsystem

gcc / c++

Date

2026-04-17

Author

Jason Merrill

Commit

219d9f4b006e19ea49b0e1ca6706fc1204211eff

Source

github

Impact

6/10

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
c++
patch_id
commit_hash
219d9f4b006e19ea49b0e1ca6706fc1204211eff
source_type
github
headline
C++: Improve constexpr call hashing and garbage collection.
tldr
Optimizes constexpr call hashing and garbage collection to prevent use-after-free issues in recursive lambda evaluations.
why_it_matters
Fixes a potential memory corruption issue in constexpr evaluation, leading to more stable and reliable compilation.
author
Jason Merrill
impact_score
6
impact_rationale
Fixes a memory corruption issue, potentially preventing crashes or unexpected behavior during compilation.
outcome
committed
performance_win
false
breaking_change
false
series_id
series_parts
[]
tags
  • C++
  • constexpr
  • garbage collection
  • memory management
  • lambdas
discussion_id_link
bugzilla_pr
date
2026-04-17T00:00:00.000Z

This commit addresses a use-after-free issue that could occur during the evaluation of recursive constexpr lambdas, particularly when the -Wtautological-compare flag is enabled. The fix involves unsharing bindings earlier in the cxx_eval_call_expression function, specifically when creating the entry in the constexpr_call_table. This ensures that the entry refers to valid memory, even after garbage collection.