2008-04-28 03:49:49     the problem when using memecpy()

Document created by Aaronwu Employee on Aug 6, 2013
Version 1Show Document
  • View in full screen mode

2008-04-28 03:49:49     the problem when using memecpy()

Young Kyle (CHINA)

Message: 55086   

 

I used memcpy() function in my Application meet the error of " data accesss misaglined ",

 

the test program as follow:

 

int main()

 

{

 

double x,*y;

 

x=15.0;

 

memcpy(y,&x,sizeof(double));

 

return 0;

 

}

 

I don't know why it happens, when I remove this line ,it is running correctly.

 

 

QuoteReplyEditDelete

 

 

2008-04-28 04:10:56     Re: the problem when using memecpy()

Andrea Federico Grisotto (ITALY)

Message: 55088    I have tried your test code with bf537 and toolchain branch 2008 r1 revision2221 and it works fine.

 

If you need more information on misaligned error and how the compiler "implement" memcpy take a look this

thread:

http://blackfin.uclinux.org/gf/project/uclinux-dist/forum/?action=ForumBrowse&_forum_action=MessageReply&message_id=53241

QuoteReplyEditDelete

 

 

2008-04-28 04:25:33     Re: the problem when using memecpy()

Vitja Makarov (RUSSIAN FEDERATION)

Message: 55100    y is uninitalized pointer, try to compile it on your host system, and test it with valgrind.

 

or may be use python:

x = 15.

y = x

QuoteReplyEditDelete

 

 

2008-04-28 06:16:13     Re: the problem when using memecpy()

Young Kyle (CHINA)

Message: 55116    thanks both of you I know where it is wrong ,uninitialized the pointer

Attachments

    Outcomes