This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Obvious fix for libiberty/md5.c
- From: "Kaveh R. GHAZI" <ghazi at caip dot rutgers dot edu>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 11 Mar 2008 11:51:07 -0400 (EDT)
- Subject: Re: Obvious fix for libiberty/md5.c
- References: <y103aqx1hji.fsf@redhat.com>
On Tue, 11 Mar 2008, Nick Clifton wrote:
> Hi Guys,
>
> I hope that the following patch counts as obvious: The
> md5_process_bytes() routine in libiberty/md5.c uses the return value
> of the memcpy() function, but under certain circumstances memcpy can
> be aliased to bcopy() and bcopy does not have a return value.
>
> The fix is to call memcpy first and then to refer to the destination
> buffer pointer explicitly in the following call to
> md5_process_block(). Like this:
The "alias" of memcpy in libiberty itself handles the return type:
PTR
memcpy (PTR out, const PTR in, size_t length)
{
bcopy(in, out, length);
return out;
}
On what platform do we run into a situation where we're missing memcpy and
this doesn't work? Is there some system header that defines bcopy ->
memcpy directly?
--Kaveh
--
Kaveh R. Ghazi ghazi@caip.rutgers.edu