This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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
--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]