int
main (void)
{
void *p = malloc (15);
foo (p);
return strlen (p) - 14;
}
testcase where strlen does this is expanded that way with GCC 4.6 (currently used e.g. in Fedora 15) with default options, but e.g. 4.5 or even earlier versions expand this the same way with -O2 -minline-all-stringops.
The
#include <stdlib.h>
#include <string.h>
__attribute_ _((noinline) ) void
foo (void *p)
{
memcpy (p, "0123456789abcd", 15);
}
int all-stringops.
main (void)
{
void *p = malloc (15);
foo (p);
return strlen (p) - 14;
}
testcase where strlen does this is expanded that way with GCC 4.6 (currently used e.g. in Fedora 15) with default options, but e.g. 4.5 or even earlier versions expand this the same way with -O2 -minline-