hm... thanks for spotting this. will fix it in a minute. cheers, ~d
On Wednesday 26 November 2003 22:18, Michael McClafferty wrote: > Included below is a small piece of code that attempts > to "shift down" some unsigned long's in an array. The > 2nd assignment in "shiftArray()" fails: > > > // Code start --- mspgcc_bug.c --------------------------------- > // > unsigned long temp[3] = { > 0x11112222L, > 0x33334444L, > 0x00000000L > }; > > void shiftArray(unsigned long *t) > { > t[2] = t[1]; // OK - Code generated was (r15 is pointer to temp): > // mov 4(r15), 8(r15) > // mov 6(r15), 10(r15) > > t[1] = t[0]; // Fails - Generated code: > // mov @r15+, 4(r15) > // mov @r15+, 6(r15) > } > > int main(void) > { > shiftArray(temp); > return 0; > } > // > // Code end --------------------------------------------- > > > The problem is that r15 is being autoincremented in the last > two fetches/sources. It's also being used as an index for the > destination, without compensating for the fact that the fetches > have altered r15. > > Background info: > > OS: Redhat 9.0 > Tools: Built from sources, Oct 20, 2003 > CPU: MSP430F149 > Cmd Line: msp430-gcc -mmcu=msp430x149 -O2 -Wall -g -o mspgcc_bug > mspgcc_bug.c > > Am I doing something stupid, or is this really a compiler bug? > > Thanks, > Mike > > > > ------------------------------------------------------- > This SF.net email is sponsored by: SF.net Giveback Program. > Does SourceForge.net help you be more productive? Does it > help you create better code? SHARE THE LOVE, and help us help > YOU! Click Here: http://sourceforge.net/donate/ > _______________________________________________ > Mspgcc-users mailing list > Mspgcc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mspgcc-users -- /***************************************************************** ("`-''-/").___..--''"`-._ (\ Dimmy the Wild UA1ACZ `6_ 6 ) `-. ( ).`-.__.`) State Polytechnical Univ. (_Y_.)' ._ ) `._ `. ``-..-' Radio-Physics Departament _..`--'_..-_/ /--'_.' ,' Saint Petersburg, Russia (il),-'' (li),' ((!.-' +7 (812) 5403923, 5585314 *****************************************************************/