hi, I don't know if there's a bug in the memcpy function, but for sure the msp430 behaves in the wrong way if you do a mov.w in an odd memory location. While coding in asm, I have seen either the lower or the higher byte of the 16-bit word discarded (sorry, can't remember which one exactly).
I didn't investigate much, but I took word alignment as a rule (which is anyway a very good rule!) R. 2005/12/10, Dmitry <[email protected]>: > This is strange... > This bug has been fixed a while ago ... > Try to lower optimization to -O > > Cheers, > ~d > > > On Friday 09 December 2005 21:06, Andrew Paulsen wrote: > > I'm using mspgcc from 20051026 with an MSP430F1611 and compiling with > > the -Os flag. > > > > I have noticed that memcpy() sometimes works incorrectly if the source > > or destination pointer does not lie on a 2-byte boundary. If both of > > the variables in question are global, the linker complains of a > > "warning: internal error: unsupported relocation error", but if one of > > the variables is local I get no complaint at all. > > > > So, is memcpy() unsafe to use when dealing with byte arrays? > > > > For example: > > > > #include <stdlib.h> > > > > int main(void) { > > unsigned uint16 = 0; > > unsigned char uint8[3] = {1,2,3}; > > > > // This one works > > memcpy(&uint16, &uint8[0], sizeof(uint16)); > > > > // This one sometimes does not > > memcpy(&uint16, &uint8[1], sizeof(uint16)); > > } > > > > > > Regards, > > Andrew > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: Splunk Inc. Do you grep through log > > files for problems? Stop! Download the new AJAX search engine that makes > > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > > http://ads.osdn.com/?ad_idv37&alloc_id865&opÌk > > _______________________________________________ > > Mspgcc-users mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/mspgcc-users > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://ads.osdn.com/?ad_idv37&alloc_id865&opclick > _______________________________________________ > Mspgcc-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/mspgcc-users >
