Landing: 40cbcd4eedce

Project / Subsystem

gcc / c++

Date

2026-08-29

Author

Vincenzo Calabretta

Commit

40cbcd4eedce587c089492213711f4b85ac35843

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
c++
patch_id
—
commit_hash
40cbcd4eedce587c089492213711f4b85ac35843
source_type
github
headline
C++: Unshare RANGE_EXPR indices in constructors to fix mutation issues
tldr
Fixes a bug where modifying array element initializers corrupted shared constructor trees.
author
Vincenzo Calabretta
outcome
committed
performance_win
false
breaking_change
false
series_id
—
series_parts
[]
tags
  • • c++
  • • compiler bug
  • • initialization
discussion_id_link
—
bugzilla_pr
—
date
2026-08-29T00:00:00.000Z

A bug in C++‘s constructor handling, specifically when unsharing CONSTRUCTOR trees for array elements, has been resolved. The issue stemmed from RANGE_EXPR indices remaining shared after a shallow copy. This commit ensures that RANGE_EXPR indices are also copied, preventing modifications in one constructor from affecting others and thus avoiding incorrect initialization omissions.