https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98447
--- Comment #7 from Vincent Lefèvre ---
On https://godbolt.org/z/Yx7b1d this still fails with "x86-64 gcc (trunk)".
Moreover, several releases are affected: 11.1, 11.2, 11.3, 12.1, 12.2.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98447
--- Comment #6 from Vincent Lefèvre ---
On the test on godbolt, this is still failing with:
gcc (Compiler-Explorer-Build) 12.0.0 20210420 (experimental)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98447
--- Comment #5 from Vincent Lefèvre ---
This is still failing (trunk). The test on godbolt:
https://godbolt.org/z/Yx7b1d
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98447
--- Comment #4 from Vincent Lefèvre ---
So this can be simplified to
void f (unsigned long *p, int r, int i)
{
int b = 64, n = r % 64;
while (i >= 0 && b >= 0)
{
if (b <= n)
p[i--] = 1UL << b;
b -= n;
}
}
Here,
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98447
--- Comment #3 from Vincent Lefèvre ---
And the warning is triggered with the initial "b = 63", but not "b = 62" and
smaller values.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98447
--- Comment #2 from Vincent Lefèvre ---
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 th
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98447
--- Comment #1 from Vincent Lefèvre ---
This is probably due to commit 5e00ad3ffbfb4df7242c313a0d836f5b538eb2fb (where
this warning was introduced, as requested by PR97424).