https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81877
--- Comment #9 from Alexander Monakov <amonakov at gcc dot gnu.org> --- I don't understand how LIM may deduce that store sinking is safe without considering may-alias relations. If it is UB to write the same object from different declared-independent iterations, then I think the correct deduction would be "iteration count is at most 1", not "store sinking is safe"? A C++ variation of the test, doesn't need -fno-tree-sra or asm() shenanigans: void g(int p, int *out) { int x = 0, y; #pragma GCC ivdep for (int i = 0; i < 100; i++) { int &r = p ? x : y; r = 42; out[i] = x; } }