This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: Broken memcpy() in 68K
- From: Robert Morin <robert dot morin at gmail dot com>
- To: Maxim Kuvyrkov <maxim at codesourcery dot com>
- Cc: newlib at sources dot redhat dot com, Jeff Johnston <jjohnstn at redhat dot com>
- Date: Mon, 7 Dec 2009 14:47:11 -0500
- Subject: Re: Broken memcpy() in 68K
- References: <4B1D443C.8080108@codesourcery.com> <4B1D4E82.90506@codesourcery.com>
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
>