Landing: 7686bcbb2b7b

Project / Subsystem

gcc / tree-optimization

Date

2026-09-01

Author

Richard Biener

Commit

7686bcbb2b7b08688008a6a0e29e6561af1a9a98

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
tree-optimization
patch_id
—
commit_hash
7686bcbb2b7b08688008a6a0e29e6561af1a9a98
source_type
github
headline
Avoid undefined behavior in CHREC optimization for signed overflow
tldr
Ensures peeled CHREC optimization correctly guards against signed integer overflow to prevent undefined behavior.
author
Richard Biener
outcome
committed
performance_win
false
breaking_change
false
series_id
—
series_parts
[]
tags
  • • optimization
  • • scalar evolution
  • • UB
  • • loops
discussion_id_link
—
bugzilla_pr
—
date
2026-09-01T00:00:00.000Z

An optimization for handling peeled CHRECs (CHange RECords) has been modified to prevent undefined behavior (UB) when dealing with signed integer overflow. Previously, this optimization could incorrectly infer loop bounds, leading to wrong iteration counts. The change guards the optimization when non-wrapping overflow is detected, ensuring correctness and preventing regressions in loop analysis and related optimizations.