http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59644
--- Comment #21 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Markus Trippelsdorf from comment #20) > (In reply to Jakub Jelinek from comment #19) > > (In reply to Markus Trippelsdorf from comment #17) > > > If I add "pushq %r10" and "popq %r10" by hand, the kernel boots fine. > > > > Thanks. Now, can you please try to use pushq %r9 and popq %r9 instead? > > Adding "pushq %r9" and "popq %r9" also results in a bootable kernel... Ah, I see what is going wrong, sorry for your wasted time. The problem is that ix86_save_reg is called already with crtl->stack_realign_finalized == false, e.g. in ix86_initial_elimination_offset, at that point ix86_save_reg will return true for the drap register and thus it is accounted for during RA, but if we don't count it later on, ix86_compute_frame_layout will compute a different layout.