Landing: 86a93aaef14c
Project / Subsystem
gcc / libstdc++
Date
2026-06-01
Author
Tomasz Kamiński
Commit
86a93aaef14c1597f531a826f0004c6a86e9fdd4
Source
github
Perf win
No
Breaking
No
All attributes
- project
- gcc
- subsystem
- libstdc++
- patch_id
- —
- commit_hash
- 86a93aaef14c1597f531a826f0004c6a86e9fdd4
- source_type
- github
- headline
- libstdc++: Fix weight computation in piecewise_linear_distribution constructor.
- tldr
- Corrects weight calculation for `piecewise_linear_distribution` to match the standard.
- author
- Tomasz Kamiński
- outcome
- committed
- performance_win
- false
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • libstdc++
- • random
- • cpp
- • bugfix
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-06-01T00:00:00.000Z
The constructor for piecewise_linear_distribution(nw, xmin, xmax, fw) in libstdc++ incorrectly computed weights. Instead of using __fw(_M_int[k]) as required by the standard, it used __fw(_M_int[k] + __delta), effectively accessing __fw(_M_int[k + 1]). This commit corrects the weight computation to align with the C++ standard. A new test case and documentation updates are included.