https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98447
--- Comment #2 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> --- Note: The warning occurs when the compiler knows that b < 63 in the "if" case (it occurs up to "n = r % 64", but not with "n = r % 65") so that the condition "b + 1 >= 64" is always false. I suppose that the p[i--] line has already been simplified to something equivalent to p[i--] = 1UL << (b + 1); but the analyzer doesn't see that b has restricted values in the "if" case. if (n > b) { p[i--] = 1UL << (b + 1); b += 64; } triggers the warning, but not if (63 > b) { p[i--] = 1UL << (b + 1); b += 64; }