This is the mail archive of the libc-alpha@sourceware.cygnus.com mailing list for the glibc project.


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

Re: Strict aliasing affects glibc 2.1.1 as well as Linux



> I wonder if we shouldn't just implement __builtin_memcpy, ala
> __builtin_memset, and then let Linux, glibc, etc. use it.  By doing
> this internally, we would a) avoid the aliasing issues, and b) allow
> the back-end maintainers to provide implementations that work as well
> as possible on their particular targets.  There's no reason that glibc
> authors should have to write conditionalized macros in order to get
> the best memcpy performance on different machines, is there?

Maybe I'm without context here, but ... gcc does implement
__builtin_memcpy already, as well as a number of more library
calls. However, these functions will fall-back to the library versions
under certain circumstances. In particular:

- __builtin_memcpy is memcpy if the size_t argument is not constant.
- __builtin_memset is memset if the size is not constant, or if the
  'c' argument is not zero (i.e. it works for bzero only)

So, __builtin_memset is more restricted than __builtin_mempcy.

Or was the talk about something completely different?

Regards,
Martin


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