This is the mail archive of the
mailing list for the GCC project.
Re: strlen optimizations based on whether stpcpy is declared?
On 10/02/2017 11:54 AM, Joseph Myers wrote:
On Mon, 2 Oct 2017, Martin Sebor wrote:
IMO, a reasonable question a GCC user might ask is: when I make
a call to a standard library function via __builtin_foo() in
a language conformance mode where foo is not a standard function,
can I expect GCC to transform it to some equivalent call to
a function that is defined by the standard (or expand it inline)?
I don't know what the answer should be, but whatever we might
want it to be, it seems worth documenting.
It may transform it, but is not required to do so; calling foo is also OK.
<https://gcc.gnu.org/ml/gcc-patches/2014-12/msg00409.html> has my
analysis of what I think is correct in this area (which may not be the
same as what is currently implemented).
Thanks! That's a perfect reference -- it even discusses
__builtin_foo! :) The past discussion of the stpcpy specifics
is especially helpful(*). I'll have to take some time to digest
it but from what I've read so far just mentioning what you said
above should in line with everyone's view (IIUC). If that's so
I'll propose an update to the Other Builtins section to mention
something along those lines.
[*] I would still be curious to know why stpcpy alone is treated
special and not other built-ins as well, and what happened to
Richard's patch referenced in that thread:
It doesn't look like it was ever committed (I don't see
the changes in c/c-decl.c/cp/decl.c).