Landing: a382bed036aa

Project / Subsystem

gcc / c++

Date

2026-09-29

Author

Jonas Hansen

Commit

a382bed036aa5f58622fc7551734f6280d1476c9

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
c++
patch_id
—
commit_hash
a382bed036aa5f58622fc7551734f6280d1476c9
source_type
github
headline
Normalize character array initializers after folding
tldr
Character array initializers are now normalized after constant folding to prevent false warnings.
author
Jonas Hansen
outcome
committed
performance_win
false
breaking_change
false
series_id
—
series_parts
[]
tags
  • • c++
  • • optimization
  • • warning
discussion_id_link
—
bugzilla_pr
—
date
2026-09-29T00:00:00.000Z

This change normalizes character array initializers after constant folding to resolve a false -Wformat-truncation warning. Previously, the conversion of braced lists to strings did not account for TARGET_EXPR, allowing character arrays within constexpr aggregates to retain a CONSTRUCTOR form. This led the compiler to incorrectly interpret array elements as single-character strings, triggering warnings for bounded snprintf calls. The fix moves the conversion to occur after constant folding, ensuring it sees the correctly folded initializer.