http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56888
--- Comment #22 from Bernd Edlinger <bernd.edlinger at hotmail dot de> --- (In reply to Richard Biener from comment #21) > -fno-tree-loop-distribute-patterns is the reliable way to not transform loops > into library calls. Thanks! Adding this fixed the generated code: #pragma GCC optimize ("no-tree-loop-distribute-patterns") BTW their memset.c looks like this: externC void * memset( void *s, int c, size_t n ) __attribute__ ((weak, alias("_memset"))); void * _memset( void *s, int c, size_t n ) { while (...) }