https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105562
--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> --- diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc index d4d0aba880c..9f7f12846cb 100644 --- a/gcc/tree-ssa-sccvn.cc +++ b/gcc/tree-ssa-sccvn.cc @@ -2593,6 +2593,11 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_, bool lhs_ref_ok = false; poly_int64 copy_size; + /* We can optimistically disambiguate against CLOBBERs, when there + is any overlap it would be undefined behavior. */ + if (gimple_clobber_p (def_stmt)) + return NULL; + /* First try to disambiguate after value-replacing in the definitions LHS. */ if (is_gimple_assign (def_stmt)) { avoids the diagnostics.