Broken memcpy() in 68K
Robert Morin
robert.morin@gmail.com
Wed Dec 9 12:37:00 GMT 2009
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
-----Original Message-----
From: newlib-owner@sourceware.org [mailto:newlib-owner@sourceware.org]
On Behalf Of Maxim Kuvyrkov
Sent: 07-Dec-2009 13:51
To: Robert Morin
Cc: newlib@sources.redhat.com; Jeff Johnston
Subject: Re: Broken memcpy() in 68K
Robert Morin:
> Hi,
>
> I am porting some 68K C source code from HP-UX to GCC/Cygwin and I
> found out the memcpy.S in newlib/libc/machine/m68k/memcpy.S is not
> working when the src is not aligned.
Hi Robert,
I looked at the memcpy() implementation for m68k and didn't spot what
the problem may be when src is not aligned. Could you produce a
testcase to reproduce the error you're seeing?
--
Maxim Kuvyrkov
CodeSourcery
maxim@codesourcery.com
(650) 331-3385 x724
On Mon, Dec 7, 2009 at 1:50 PM, Maxim Kuvyrkov <maxim@codesourcery.com> wrote:
> Robert Morin:
>
>> Hi,
>>
>> I am porting some 68K C source code from HP-UX to GCC/Cygwin and I
>> found out the memcpy.S in newlib/libc/machine/m68k/memcpy.S is not
>> working when the src is not aligned.
>
> Hi Robert,
>
> I looked at the memcpy() implementation for m68k and didn't spot what the
> problem may be when src is not aligned. Could you produce a testcase to
> reproduce the error you're seeing?
>
> --
> Maxim Kuvyrkov
> CodeSourcery
> maxim@codesourcery.com
> (650) 331-3385 x724
>
More information about the Newlib
mailing list