RE: libm -fno-builtin

<[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
Hi Wilco,

>Removing -fno-builtin should have no negative effects except for eg. memcpy
where compilers
> can recognize an overly simplistic implementation and optimize it to a
call to memcpy... 
>I think you will need a -fno-builtin-memcpy when building the size
optimized
> version of libc/string/memcpy.c given it is marked with restrict.

Using -fno-builtin-memcpy doesn't prevent GCC from replacing a loop with a
call to memcpy (likewise for memset). As Joesph said before,
-fno-tree-loop-distribute-patterns should be used for that. However, this
probably it isn't needed, as this only gets enabled at -O3 anyway, and
Newlib compiles with O2.

Note that -fno-builtin does prevent this, oddly, but obviously we don't want
to use that.

Perhaps GCC should be a little bit more clever, and not try to use this
optimisation if the function called matches the name of the function being
compiled.

Cheers,
Jon
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.