Landing: 6d218b0ffbd5

Project / Subsystem

gcc / tree-optimization

Date

2026-04-27

Author

Richard Biener

Commit

6d218b0ffbd54ca438e904fccad86d226f26bb91

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
tree-optimization
patch_id
commit_hash
6d218b0ffbd54ca438e904fccad86d226f26bb91
source_type
github
headline
Tree-optimization: Avoids ICE with niter Analysis and UBSAN.
tldr
The compiler now avoids an internal compiler error (ICE) when using niter analysis with UBSAN by preventing negation of the most negative signed integer.
author
Richard Biener
outcome
committed
performance_win
false
breaking_change
false
series_id
series_parts
[]
tags
  • tree-optimization
  • niter analysis
  • ubsan
  • ice
  • loop optimization
discussion_id_link
bugzilla_pr
date
2026-04-27T00:00:00.000Z

This commit fixes an internal compiler error (ICE) that occurred when using the niter analysis (loop iteration analysis) in conjunction with UBSAN (Undefined Behavior Sanitizer). The issue arose when computing the absolute step of a loop by negating a signed step, which could result in negating the most negative signed integer. The fix converts the signed step to an unsigned value before negating it, thus avoiding the undefined behavior. A new testcase was added to verify the fix.