[Bug tree-optimization/105198] [11/12 Regression] Wrong code for C loop (GCC 12 -O2, GCC 11 -O3)
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Apr 8 09:12:14 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105198
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Reduced testcase for the predictive commoning issue, fails with -O3 or
-O2 -fno-tree-pre -fpredictive-commoning
static __attribute__ ((noipa)) void
next_set(int *x, int n, int k)
{
int j, tmp;
j = k - 1;
tmp = x[j]++;
while(j > 0 && x[j] >= n - (k - 1 -j))
{
j--;
x[j]++;
tmp = x[j];
}
if (tmp != 2 || j != 1 || x[0] != 0 || x[1] != 2 || x[2] != 5)
__builtin_abort ();
}
int main()
{
int x[3] = {0, 1, 4};
next_set(x, 5, 3);
return 0;
}
More information about the Gcc-bugs
mailing list