This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] don't bzero->memset if cfun is memset
- From: Roger Sayle <roger at eyesopen dot com>
- To: DJ Delorie <dj at redhat dot com>
- Cc: <mark at codesourcery dot com>, <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 11 Jul 2002 21:00:01 -0600 (MDT)
- Subject: Re: [PATCH] don't bzero->memset if cfun is memset
> > Indeed because "index" and "bzero" aren't ANSI, there is even more
> > motivation to implement them via "strchr" and "memset" that are
> > "asserted" to be available.
>
> Because they aren't ANSI, gcc should make no assumptions about them at
> all. Modifying a call to bzero() in an ANSI compiler violates the
> ANSI spec by corrupting the namespace - how do we know that the user
> hasn't written a bzero function that does something unique and just
> happens to have the same argument signature as the BSD function by
> that name?
Indeed, converting "bzero" into memset in a GCC extension. If you
specify "-ansi" or an appropriate "-std=", GCC no longer recognizes
bzero, index, et al. as builtins. [suggestion #4]
Personally, I believe its a reasonable "feature". Many legacy programs
use "bzero" and friends, and to get best perfromance out of them GCC
uses it's "memset" inlining routines. On the other hand, GCC itself
contains "#pragma GCC poison bzero" to prevent users from using these
historical APIs.
Roger
--