https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105690
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|c |ipa Status|UNCONFIRMED |NEW Blocks| |56456 Keywords| |wrong-debug Ever confirmed|0 |1 Last reconfirmed| |2022-05-23 CC| |hubicka at gcc dot gnu.org, | |marxin at gcc dot gnu.org --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- OK, so the diagnostic is misleading: else if (vr && vr->kind () == VR_ANTI_RANGE) { if (up_bound && TREE_CODE (up_sub) == INTEGER_CST && (ignore_off_by_one ? tree_int_cst_lt (up_bound, up_sub) : tree_int_cst_le (up_bound, up_sub)) && TREE_CODE (low_sub) == INTEGER_CST && tree_int_cst_le (low_sub, low_bound)) warned = warning_at (location, OPT_Warray_bounds, "array subscript [%E, %E] is outside " "array bounds of %qT", low_sub, up_sub, artype); it should say warning: array subscript ~[0, 19] is outside array bounds of ... or given anti-ranges are odd maybe say warning: array subscript [..., 0[ U ]19, ...] is outside of array bounds ... or warning: array subscript not in [0, 19] is outside of array ... ? Note it's odd we somehow end up with <bb 2> [local count: 1073741824]: idx.2_8 = (unsigned int) idx_1(D); if (idx.2_8 <= 19) goto <bb 4>; [50.00%] else goto <bb 3>; [50.00%] <bb 3> [local count: 536870912]: _11 = gtable[idx_6].mode; goto <bb 9>; [100.00%] somehow function splitting exposes this, but since all calls to .part.0 are properly guarded this is senseless doing (maybe IPA with VRP info does something odd here with the signed/unsigned promotion) Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456 [Bug 56456] [meta-bug] bogus/missing -Warray-bounds