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

memcpy Prototype.


Hi,

I am writing a port of gcc to a 16-bit DSP. The machine's ABI passes all
parameters on the stack, and allocates space on the stack for return
values. I use a memcpy which is:

void* memcopy(void *dest, const void *src, size_t n)

This has 4 stack locations - the return address and the three actual
arguments. However, if the compiler generates a call to memcpy (e.g., to
move large struct's around), it ignores the return value, and only passes
the three actual parameters on the stack, resulting in the arguments being
effectively shifted by one (i.e., the destination becomes the source, the
source becomes `n', and `n' becomes undefined).

How can I prevent this happening? Why doesn't gcc use the correct memcpy
prototype?

Thanks,

Dan.

===============================================================================
Dan Towner                           |
                                     |
Computer Science Department          | Email: D.W.Towner@bristol.ac.uk
University of Bristol                | Web:   http://www.cs.bris.ac.uk/~towner
Merchant Venturers Building          | Phone: 44 (0)117 954 5256
Woodland Road, Bristol, UK           |
BS8 1UB                              |
===============================================================================


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