Landing: 17c7aeffec9e
Project / Subsystem
gcc / tree-optimization
Date
2026-09-30
Author
Dominic P
Commit
17c7aeffec9e1f7576957fdcb21e380d4e209c6f
Source
github
Perf win
No
Breaking
No
All attributes
- project
- gcc
- subsystem
- tree-optimization
- patch_id
- —
- commit_hash
- 17c7aeffec9e1f7576957fdcb21e380d4e209c6f
- source_type
- github
- headline
- forwprop: Reset MOD result range when X is negative
- tldr
- Fixes incorrect constant folding of the MOD operator when the dividend can be negative.
- author
- Dominic P
- outcome
- committed
- performance_win
- false
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • optimization
- • compiler
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-09-30T00:00:00.000Z
The forward propagation pass in GCC incorrectly preserved the range of a MOD result even when the dividend was negative. This led to incorrect folding of the result to zero in specific cases. This change resets the flow-sensitive information of the MOD result when its value is rewritten under these conditions, ensuring accurate constant propagation.