https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68021
--- Comment #4 from Yuri Rumyantsev <ysrumyan at gmail dot com> --- Indeed, there is an issue with outer-loop unswitching - it should not be performed for infinite loops. But if we slightly modify test if finite outer-loop we will get the same error: char a; void fn1(char *p1, int p2, int p3) { int i, x; for (i = 0; i < 10; i++) { for (x = 0; x < p3; x++) { *p1 = a; p1--; } p1 += p2; } } I assume that sccp is responsible for it.