This bug was previously mentioned in email from Denis. I have confirmed this on 4.5 (after long but educational tour of reload)
When stacks slots increase from zero in reload() (in my case due to setup_save_areas() ) the register elimination conditions can change. For example the AVR port has:
get_frame_size () > 0
as part of frame_pointer_required_p thus FP->SP elimination can change.
New slots do restart the spill and reload loop :
/* If we allocated another stack slot, redo elimination bookkeeping. */
if (starting_frame_size != get_frame_size ())
BUT update_eliminables is never called before calculate_needs_all_insns(), so the wrong reloads are calculated (in my case marking the FP to be spilled in the just added caller save insn !)
As a consequence, a spill and reload failure occurs.
The solution would seem to be to add update_eliminables before calculate_needs_all_insns (global);
Andy, do you have a test case for this bug?
(In reply to Eric Weddington from comment #1)
> Andy, do you have a test case for this bug?
Closed since reporter never provided a test case, leaving this bug stuck in WAITING for so long.