Landing: cb9d160c4dab

Project / Subsystem

gcc / middle-end

Date

2026-09-24

Author

Jakub Jelinek

Commit

cb9d160c4dab693a3fc214736db2441ebbee6c35

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
middle-end
patch_id
—
commit_hash
cb9d160c4dab693a3fc214736db2441ebbee6c35
source_type
github
headline
Fix C++26 uninitialized read behavior for P2795R5
tldr
Corrects C++26 handling of uninitialized reads to ensure consistent values and diagnostics.
author
Jakub Jelinek
outcome
committed
performance_win
false
breaking_change
false
series_id
—
series_parts
[]
tags
  • • c++
  • • middle-end
  • • optimization
  • • standard conformance
  • • uninitialized reads
discussion_id_link
—
bugzilla_pr
—
date
2026-09-24T00:00:00.000Z

This commit fixes an incorrect implementation of the C++26 P2795R5 standard concerning uninitialized reads. The standard requires that multiple reads of the same uninitialized variable yield a consistent (though unspecified) value and that such uses are diagnosed. The previous implementation incorrectly optimized these reads in the middle-end passes, violating the standard’s requirements. This fix ensures that uninitialized reads are treated more conservatively, preserving their value consistency and allowing for diagnostics.