https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78327
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|-Walloca-large-than false |Improve VRP for ranges of |positives due to bad range |signed char |info for signed integers in | |[-TYPE_MAX + N, N] | Severity|normal |enhancement --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- The problem is related to anything described here. The problem is VRP is not adding an assert in the true case of for n_9 usage: <bb 2>: n.0_1 = (unsigned char) n_9(D); _2 = n.0_1 + 125; _3 = (signed char) _2; if (_3 < 0) goto <bb 4>; else goto <bb 3>; <bb 3>: _15 = (int) n_9(D); _17 = _15 + 128; _19 = (long unsigned int) _17; <bb 4>: # prephitmp_20 = PHI <_19(3), 128(2)> ------ CUT ----- Basically when we look at the if statement of if (_3 < 0) we don't recognize it is doing ((signed char)(((unsigned char) n_9) + 125)) < 0. This should be an easy thing to implement in VRP. Here is a simple testcase without warnings. void link_failure (); void g (signed char n) { if (n < -125 || 2 < n) n = 0; if ((n + 128) > 130) link_failure(); } void h (signed char n) { if (n < -125 || 1 < n) n = 0; if ((n + 128) > 129) link_failure(); } void g1 (int n) { if (n < -125 || 2 < n) n = 0; if ((n + 128) > 130) link_failure(); } void h1 (int n) { if (n < -125 || 1 < n) n = 0; if ((n + 128) > 129) link_failure(); } Again this has nothing to with anti-range as there is no ranges being produced here by VRP for g.