https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38470
Andrew Macleod <amacleod at redhat dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |amacleod at redhat dot com --- Comment #18 from Andrew Macleod <amacleod at redhat dot com> --- The code as shown gets generated right off the bat in SSA as <bb 2> : _1 = ABS_EXPR <x_2(D)>; _3 = (unsigned int) _1; return _3; which shouldn't even need the Ranger for. globally _1 should be [0, MAX] and I wouldn't expect any warning... If you tweak the code so it shows the if structure: if (x >= 0) return x ; return -x; Then then ranger could help produce the same info: =========== BB 2 ============ x_3(D) [-INF, +INF] int <bb 2> : if (x_3(D) >= 0) goto <bb 3>; [INV] else goto <bb 4>; [INV] 2->3 (T) x_3(D) : [0, +INF] int 2->4 (F) x_3(D) : [-INF, 0xffffffff] int =========== BB 3 ============ x_3(D) [0, +INF] int <bb 3> : _5 = (unsigned int) x_3(D); // predicted unlikely by early return (on trees) predictor. goto <bb 5>; [INV] _5 : [0, 0x7fffffff] unsigned int =========== BB 4 ============ x_3(D) [-INF, 0xffffffff] int <bb 4> : _1 = -x_3(D); _4 = (unsigned int) _1; _1 : [1, +INF] int _4 : [1, 0x7fffffff] unsigned int =========== BB 5 ============ <bb 5> : # _2 = PHI <_5(3), _4(4)> return _2; _2 : [0, 0x7fffffff] unsigned int It recognizes that both: a) _3(D) [0, +INF] int is positive before being "cast" to unsigned int _5 b) _1 is always positive when the conversion to unsigned int is made in BB4. So the information would be there if one knew what to look for and how to use it.