https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63393
--- Comment #4 from Evgeniy Dushistov <dushistov at mail dot ru> --- (In reply to Mikael Pettersson from comment #3) > I don't know if this is supposed to be "fixed" (for all str* and mem* > functions one might want to implement oneself), but the standard workaround > is to compile with -fno-tree-loop-distribute-patterns. The -ffreestanding > does nothing for these annoying transformations. Not sure why you think so. >From gcc manual: >a "conforming freestanding implementation" is only required to provide certain >library facilities: those in `<float.h>', `<limits.h>', `<stdarg.h>', >and `<stddef.h>'; since AMD1, also those in `<iso646.h>'; since C99, >also those in `<stdbool.h>' and `<stdint.h>'; and since C11, also those >in `<stdalign.h>' and `<stdnoreturn.h>' So in "freestanding" case we have no "string.h" and compiler should not insert any function calls from it.