This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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: Broken memcpy() in 68K


On 12/7/09 10:47 PM, Robert Morin wrote:
Hi Maxim,

I checked against version 1.4 of src/newlib/libc/machine/m68k/memcpy.S.

//
// Must be bigger than 8 bytes to bypass test at line 40 // const char
SrcTestString[] = "01234567890"; char DestTestString[ 20 ];

int main( int argc, char **argv ) {

   // Working since src and dest are properly aligned by the compiler.
   memcpy(&DestTestString[ 0 ],&SrcTestString[ 0 ], sizeof( SrcTestString ));

   // Dst is aligned but src is not, should create an address error at line 63.
   memcpy(&DestTestString[ 0 ],&SrcTestString[ 1 ], sizeof(
SrcTestString) - 1 ));

   exit( 0 );
}

Robert,


Which hardware do you test this on? I'm using one of the ColdFire boards and it works fine. I'm guessing that your CPU does not have a misalignment module. Is it the case?

--
Maxim Kuvyrkov
CodeSourcery
maxim@codesourcery.com
(650) 331-3385 x724


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