https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95556

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Jeff Davis from comment #7)
> "...built-in functions are optimized into the normal string functions like
> memcpy if the last argument is (size_t) -1..."
> 
> My reading of the document lead me to believe that a last argument of -1
> *would* be a normal library call. And certainly should be with
> -fno-builtin-memcpy, right?

No.  Because -fno-builtin-memcpy only disables the special behavior if one uses
memcpy, when one uses __builtin_memcpy, it behaves always as builtin.  And you
are using __builtin___memcpy_chk which is also a builtin and thus not affected
by -fno-builtin*.
You can use -fno-builtin-__memcpy_chk but then you'll get __memcpy_chk calls if
you call it that way.
As I wrote, if you for whatever reason want to use the library call, e.g.
always, you can just use -mmemcpy-strategy=libcall:-1:1 or so, but then even
very small ones will not be done inline, which is not really beneficial.

Reply via email to