Hi! On Mon, Apr 13, 2020 at 10:11:43AM +0800, luoxhu wrote: > frame_pointer_needed is set to true in reload pass setup_can_eliminate, > but regs_ever_live[31] is false, pro_and_epilogue uses it without live > check causing CPU2006 465.tonto segment fault of loading from invalid > addresses due to r31 not saved/restored. Thus, add HARD_FRAME_POINTER_REGNUM > live check with frame_pointer_needed_indeed_p when generating pro_and_epilogue > instructions.
I see. Can you instead make a boolean variable "frame_pointer_needed_indeed", that you set somewhere early in *logue processing? So that we can be sure that it will not change behind our backs. > void > rs6000_emit_prologue_components (sbitmap components) > { > rs6000_stack_t *info = rs6000_stack_info (); > - rtx ptr_reg = gen_rtx_REG (Pmode, frame_pointer_needed > - ? HARD_FRAME_POINTER_REGNUM > - : STACK_POINTER_REGNUM); > + rtx ptr_reg = gen_rtx_REG (Pmode, frame_pointer_needed_indeed_p () > + ? HARD_FRAME_POINTER_REGNUM > + : STACK_POINTER_REGNUM); Yeah, I got the indent wrong there, thanks for fixing it :-) These four cases might well be the only four you need to fix here, but I'll double-check it tomorrow, when I'm awake ;-) Thanks! Segher