https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110035
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Pontakorn Prasertsuk from comment #7) > For the LLVM IR code of the snippet I provided, Clang's alias analysis can > prove that `new` call has no side effect to other memory location. This is > indicated by `noalias` keyword at the return value of the `new` call (_Znwm). > > According to Clang's Language Reference: > "On function return values, the noalias attribute indicates that the > function acts like a system memory allocation function, returning a pointer > to allocated storage disjoint from the storage for any other object > accessible to the caller." > > Is this possible for GCC alias analysis pass? > MyClass c = a; > MyClass *b = new MyClass; > *b = c; the point is that 'new' can alter the value of 'a', GCC already knows that 'b' is distinct from c and a but that's not the relevant thing. It looks like LLVM creates wrong-code here.