This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

problem with casting for arm compiler

Hi all
I have a strange problem when I'm trying to cast buffers by arm compiler.
Here an example:

char* pbuf;
...
unsigned short val = *((unsigned short*)(pbuf+3));


When I compile this code, my generated assembly code uses LDRH,STRH. Then because my pbuf+3 is not multiple of 2 and those 2 instruction can only work with even value addresses, processor hangs up.
What I should to do that compiler generates a code that works in all cases?

Regards

0