Landing: 435ff0c5dff1
Project / Subsystem
gcc / tree-optimization
Date
2026-06-05
Author
Richard Biener
Commit
435ff0c5dff136eef427872991398ee09739fa3b
Source
github
Perf win
No
Breaking
No
All attributes
- project
- gcc
- subsystem
- tree-optimization
- patch_id
- —
- commit_hash
- 435ff0c5dff136eef427872991398ee09739fa3b
- source_type
- github
- headline
- Tree optimization: Avoid negating the most negative signed value during loop analysis
- tldr
- GCC's tree-ssa-loop-niter pass now avoids incorrect negation of the most negative signed integer, preventing potential compiler misbehavior with loop iteration…
- author
- Richard Biener
- outcome
- committed
- performance_win
- false
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • optimization
- • loops
- • bugfix
- • integer-overflow
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-06-05T00:00:00.000Z
GCC’s number_of_iterations_until_wrap function, part of the tree-ssa-loop-niter optimization pass, has been improved to prevent the problematic negation of the most negative signed integer value. This issue, identified by PR125602, could lead to incorrect INTEGER_CST results during loop analysis. The fix restructures the negation and type conversion logic to avoid this overflow, ensuring accurate calculation of loop bounds and preventing potential miscompilations.