← Back to Pull requests

Fix write_significand buffer size to avoid GCC 16 LTO -Wstringop-overflow (#4767) #4957

Closed
unknown closed this pull request without merging on Oct 02, 2026 17:54 UTC
View on GitHub
unknown unknown commented on Sep 21, 2026 18:47 UTC
Author

Description

  • Increase the temporary buffer in write_significand to ensure there is enough headroom for backward writes performed by the digit-writing path under LTO.

  • Change: digits10<UInt>() + 2 -> digits10<UInt>() + 3 in include/fmt/format.h.
  • Rationale

  • GCC 16 with LTO reports -Wstringop-overflow in the floating-point formatting path because the backward-writing routine can touch significand_size + 1 bytes while the previous buffer allocation was tight in one edge case.

  • Increasing the buffer by one element removes the off-by-one risk without changing observable behavior.
  • Verification

  • Built on Windows (MSYS2 UCRT64) with:

  • - gcc 16.2.0, g++ 16.2.0, cmake 4.4.3
    - cmake configured with -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
  • Example link-time warning excerpt observed during build (for reviewer context):
  • warning: writing 2 bytes into a region of size 0 [-Wstringop-overflow=]
    include/fmt/format.h:1375:11: memcpy(out, digits2(value), 2);
    note: at offset [-13, -2] into destination object 'buffer' of size 12
    include/fmt/format.h:2659:8: Char buffer[digits10<UInt>() + 3];

    Compatibility & Risk

  • No API or behavioral changes.

  • Minimal internal change to buffer sizing; low risk.
  • Suggested testing

  • Build with GCC 16 + LTO (-flto) on CI (MSYS2/Ubuntu with GCC 16) to confirm no false-positive -Wstringop-overflow remains.

  • Run unit tests with and without LTO to ensure no regressions.
  • Notes

  • If maintainers prefer not to change allocation, an alternate approach is to gate a compiler warning suppression for affected toolchains. The buffer-size fix is simpler and safer.
  • Diff: 203 lines (+152 / -51) across 2 files Reviewer: Boulea7 Review duration: 15786m
    All Vouch review confidence checks passed
    Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 203 lines diff across 2 files
    0.36
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.318
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #4957"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 36.3% (MEDIUM) · Higher = larger blast radius
    36.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 14.3% · Safe to merge
    14.3%
    Repository