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: Obvious fix for libiberty/md5.c


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


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