This is the mail archive of the gcc-help@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]

Re: amazing memcpy bug on Solaris


mhalibard@csafe.com wrote:
> I have encountered a truly amazing bug when compiling with gcc on
> solaris. I would be grateful to anybody who can explain what on earth
> is going wrong.

In linux man memcpy:
	void *memcpy(void *dest, const void *src, size_t n);

DESCRIPTION
       The  memcpy() function copies n bytes from memory area src
       to memory area dest.  The memory areas  may  not  overlap.
       Use memmove(3) if the memory areas do overlap.

On solaris 2.6 man memcpy:
	void *memcpy(void *s1, const void *s2, size_t n);

     memcpy() copies n bytes from  memory  area  s2  to  s1.   It
     returns s1.


You seem to copy from the outBuff into the buffer_ptr, which is
const in the first example.

Try to swap the buffer_ptr and outBuff arguments.
-- 
Kind regards,
			Dennis Bijwaard (remove antispam to reply)
			http://people.a2000.nl/dbijwaar


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