Landing: 706c0877e818

Project / Subsystem

gcc / c++

Date

2026-07-22

Author

Marek Polacek

Commit

706c0877e818b1035b763863b227d4d928ade421

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
c++
patch_id
commit_hash
706c0877e818b1035b763863b227d4d928ade421
source_type
github
headline
C++: Fix constant recomputation for changed ADDR_EXPR.
tldr
Bug fix ensures constants are recomputed correctly when ADDR_EXPR changes in constexpr evaluations.
author
Marek Polacek
outcome
committed
performance_win
false
breaking_change
false
series_id
series_parts
[]
tags
  • c++
  • constexpr
  • bugfix
  • compiler
discussion_id_link
bugzilla_pr
date
2026-07-22T00:00:00.000Z

This commit fixes a bug where constants were not being recomputed when an ADDR_EXPR changed within constant evaluation contexts. The issue arose because the recomputation logic (recompute_tree_invariant_expr) was only applied to the first ADDR_EXPR encountered, not subsequent ones. The fix involves ensuring unshare_expr is called correctly during placeholder replacement in lookup_placeholder, particularly when shared trees are involved.