Landing: de3a13dd7f6c

Project / Subsystem

gcc / tree-optimization

Date

2026-06-08

Author

Richard Biener

Commit

de3a13dd7f6c2856e96fc2b7924f9b34b638940f

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
tree-optimization
patch_id
commit_hash
de3a13dd7f6c2856e96fc2b7924f9b34b638940f
source_type
github
headline
SCEV constant folding avoids signed overflow undefined behavior.
tldr
A latent bug in SCEV's `chrec_fold_plus_poly_poly` that could lead to signed overflow undefined behavior has been addressed.
author
Richard Biener
outcome
committed
performance_win
false
breaking_change
false
series_id
series_parts
[]
tags
  • optimization
  • bugfix
  • scev
  • undefined-behavior
discussion_id_link
bugzilla_pr
date
2026-06-08T00:00:00.000Z

This commit fixes a latent issue within GCC’s Scalar Evolution (SCEV) component, specifically in the chrec_fold_plus_poly_poly function. The function, responsible for folding additions of polynomial chain of recurrences (CHREC), was susceptible to signed integer overflow, resulting in undefined behavior. The current fix, similar to a previous one, addresses the most common cases involving constants to prevent this overflow, improving the reliability of loop-related optimizations.