https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87540
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Oh, and in your case there is a dependence. So "correct" and actually
compilable one:
#define ARRAY_SIZE 1024
#define N_TIMES 10000
int foo(double *array)
{
int i;
double sum;
for (i = 0; i < N_TIMES; i++)
{
// lot of code well, this loop does not even depend on "i", hoist it?
sum = 0;
for (int j = 0; j < ARRAY_SIZE; j += 8)
sum += array[j] + array[j+1] + array[j+2] + array[j+3] + array[j+4] +
array[j+5] + array[j+6] + array[j+7];
}
return sum;
}