Broken memcpy() in 68K
Maxim Kuvyrkov
maxim@codesourcery.com
Fri Dec 11 08:55:00 GMT 2009
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
More information about the Newlib
mailing list