Hi DJ, Since interrupts can happen at any time, it is possible for a ISR to be called when register bank 0 is not the currently selected bank. Hence the prologue for an interrupt handler should always select bank 0 before saving any registers. The patch below makes sure that this happens.
No regressions with a rl78-elf toolchain. OK to apply ? Cheers Nick gcc/ChangeLog 2013-01-03 Nick Clifton <ni...@redhat.com> * config/rl78/rl78.c (rl78_expand_prologue): Always select register bank 0 at the start of an interrupt handler. Index: gcc/config/rl78/rl78.c =================================================================== --- gcc/config/rl78/rl78.c (revision 194833) +++ gcc/config/rl78/rl78.c (working copy) @@ -839,6 +839,9 @@ if (flag_stack_usage_info) current_function_static_stack_size = cfun->machine->framesize; + if (is_interrupt_func (cfun->decl)) + emit_insn (gen_sel_rb (GEN_INT (0))); + for (i = 0; i < 16; i++) if (cfun->machine->need_to_push [i]) {