https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111583
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-13 branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:b28be88c311f1bc4c62309906177ab3d97800deb commit r13-8041-gb28be88c311f1bc4c62309906177ab3d97800deb Author: Richard Biener <rguent...@suse.de> Date: Fri Sep 29 11:08:18 2023 +0200 tree-optimization/111583 - loop distribution issue The following conservatively fixes loop distribution to only recognize memset/memcpy and friends when at least one element is going to be processed. This avoids having an unconditional builtin call in the IL that might imply the source and destination pointers are non-NULL when originally pointers were not always dereferenced. With -Os loop header copying is less likely to ensure this. PR tree-optimization/111583 * tree-loop-distribution.cc (find_single_drs): Ensure the load/store are always executed. * gcc.dg/tree-ssa/pr111583-1.c: New testcase. * gcc.dg/tree-ssa/pr111583-2.c: Likewise. (cherry picked from commit 962ca7149d652e4077a2259886e5cd2ea3cea0ab)