https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57359
--- Comment #22 from Richard Biener <rguenth at gcc dot gnu.org> --- Created attachment 48311 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48311&action=edit patch Note that apart from the possible bad impact on optimization when fixing this bug an actual fix is complicated by the custom "optimized" dependence analysis code in the loop invariant motion pass. A conservative "simple" patch would be the attached but that doesn't preserve store-motion for the following (because the LIM data dependence code doesn't care about stmt order): typedef int A; typedef float B; void __attribute__((noinline,noclone)) foo(A *p, B *q, long unk) { for (long i = 0; i < unk; ++i) { q[i] = 42; *p = 1; } } usually this bug doesn't manifest itself but of course the fix will be experienced everywhere. Benchmarking the simple patch might reveal it's not an issue (but I doubt that...).