https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81028
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- Simpler testcase. The sinking is valid if the aliasing does not occur in the last iteration of the loop. In case *p would be done conditionally only that would not necessarily be the case. inline void* operator new(__SIZE_TYPE__, void* __p) { return __p; } extern "C" void abort(); typedef int A; typedef float B; void __attribute__((noinline,noclone)) foo(A *p, A *q, long unk) { for (long i = 0; i < unk; ++i) { *p = 1; new (static_cast<void *>(&q[i])) B(42); } } int main(void) { union { A x; B f; } u = { 0 }; foo(&u.x, &u.x, 1); if (u.f != 42) abort(); }