https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102725
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Martin Liška from comment #2) > (In reply to Andrew Pinski from comment #1) > > You need -fno-tree-loop-distribution -fno-tree-loop-distribute-patterns to > > turn it off. There is another older bug about this for memcpy. > > Well, I would expect this optimization would do the optimization only if > __builtin_strlen is allowed (not disallowed by the option). __builtin_strlen is always allowed even if -fno-builtin. -fno-builtin just disables strlen -> __builtin_strlen conversion. See the other bugs that I referenced for an example. There are more dealing with memcpy too.