On Fri, Jan 18, 2008 at 12:24:29AM -0500, Andrew Hutchinson wrote: > I think I have found a bug with avr register allocation.
Maybe not. ;-) ... > So R0 got trashed. > > There will be other examples where this could happen as R0 is used is > quite a few places to help assembler. But the avr ABI defines it as volatile, as I understand it. At http://www.nongnu.org/avr-libc/user-manual/FAQ.html#faq_reg_usage we have: >>> r0 - temporary register, can be clobbered by any C code (except interrupt handlers which save it), may be used to remember something for a while within one piece of assembler code <<< Looks like we have licence to trash it. > > I can only assume at this time that the same could happen to R1. Nope, not a safe assumption. It must be restored if fiddled. It is "assumed to be always zero in any C code". Erik _______________________________________________ AVR-GCC-list mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
