https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104579
--- Comment #2 from Hongtao.liu <crazylht at gmail dot com> ---
One possible way is sink maxInt = src[i] out of loop, when there's synchronised
index search in the loop, just like below.
int max (int *src, int n, int *position)
{
int maxInt;
int maxIndex;
int i;
maxInt = src[0];
maxIndex = 0;
for (i = 1; i < n; i++) {
if (maxInt < src[i]) {
maxIndex = i;
}
}
maxInt = src[maxIndex];
*position = maxIndex;
return (maxInt);
}
