Problem with memcpy (294 Views)
Posts: 0
Message 1 of 3 (294 Views)

Problem with memcpy


I am facing a very strange problem with memcpy function in our C code under our build environment.

Just to give a brief history, our build system got crashed a while ago (2 months) and now we setup a new build system with same software installed of aprox. of same version as prior to crash.

Now when we build the image, image build is successfull with no errors but image is behaving abnormally. When I tried to run the debug image it is running successfully. Then I tried to put Trace-logs within the code to find where the image is failing and i figured out: memcpy is copying 1 less character from source to destination.

Could you please help me at what should i try to look at to fix this problem.

We are running Tru64 UNIX 5.1 OS and making use of GNU make to build the image. Major code is written in C.

Please let me know if any further information is requried.

Honored Contributor
Posts: 9,110
Registered: ‎02-23-2005
Message 2 of 3 (294 Views)

Re: Problem with memcpy

> Please let me know if any further
> information is requried.

How about a failing test program? My psychic
powers are too weak to tell me what's wrong
with your code if I can't see the code, how
you built it, or how you ran it. One guess:

"man memcpy":

The memcpy() function copies n bytes from the string pointed to by the s2
parameter into the location pointed to by the s1 parameter. When copying
overlapping strings, the behavior of this function is unreliable.

Does "unreliable" sound like what you're

> We are running Tru64 UNIX 5.1 OS [...]

Actual output from, say, "sizer -v" would be
more trustworthy than anything you say.

> [...] GNU make [...]

That's probably the _least_ important thing
about how the program was compiled or linked.
Posts: 0
Message 3 of 3 (294 Views)

Re: Problem with memcpy

Thanks a lot for your time and efforts.

Problem got resolved after i upgrade my C compiler to the latest version.

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.