http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56960
Bug #: 56960 Summary: How to set up stack pointer in gcc 4.7.2 Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: deepak.ka...@gmail.com void spim_prologue(void) { int i,j; emit_move_insn(gen_rtx_MEM(SImode,plus_constant(stack_pointer_rtx,-0)),return_addr_rtx); emit_move_insn(gen_rtx_MEM(SImode,plus_constant(stack_pointer_rtx,-4)),stack_pointer_rtx); emit_move_insn(gen_rtx_MEM(SImode,plus_constant(stack_pointer_rtx,-8)),hard_frame_pointer_rtx); emit_move_insn(hard_frame_pointer_rtx, plus_constant(stack_pointer_rtx,0)); for(i=0,j=4;i<FIRST_PSEUDO_REGISTER;i++) { if(df_regs_ever_live_p(i) && !call_used_regs[i] && !fixed_regs[i]) { emit_move_insn(gen_rtx_MEM(SImode,plus_constant(hard_frame_pointer_rtx,-4*j)), gen_rtx_REG(SImode,i)); j++; } } emit_insn(gen_rtx_SET(SImode, stack_pointer_rtx,plus_constant(hard_frame_pointer_rtx,-((3+j+1)*4+get_frame_size())) )); //HERE is what error comes } The last statement of the program is producing a segmentation fault when I compile a program. It worked fine when it was built on gcc-4.6.2 but creating problem for 4.7.2. Can anyone help me out?