amazing memcpy bug on Solaris
bijwaard@speed.DoNotSpamA2000.nl
bijwaard@speed.DoNotSpamA2000.nl
Fri Oct 1 00:00:00 GMT 1999
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
More information about the Gcc-help
mailing list