https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127103
Drea Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2026-08-27
Status|UNCONFIRMED |ASSIGNED
Blocks|85316 |
Ever confirmed|0 |1
Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot
gnu.org
--- Comment #1 from Drea Pinski <pinskia at gcc dot gnu.org> ---
So these two functions are the same:
```
unsigned t2(unsigned a)
{
if (a >= __INT_MAX__)
__builtin_unreachable();
unsigned t = __INT_MAX__ - a;
unsigned ttt = a > 1 ? a : 1;
ttt = ttt < t ? ttt : t;
unsigned tt = ttt + a;
return tt;
}
unsigned t(unsigned a)
{
if (a >= __INT_MAX__)
__builtin_unreachable();
unsigned b = a * 2;
a = ((signed)b) < 0 ? __INT_MAX__ : b;
a = a < 1 ? 1 : a;
return a;
}
/*
b_4 = a_2(D) * 2;
a_5 = MIN_EXPR <b_4, 2147483647>;
_8 = MAX_EXPR <a_5, 1>;
*/
```
And then we know that is always `s> 0`.
Note this only works when we know that a < __INT_MAX .
I will take this.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85316
[Bug 85316] [meta-bug] VRP range propagation missed cases