This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: altivec trashing frame ptr reg


sorry i took so long.

yes, this looks ok, provided dje is ok with it.

thanks for catching it.


>> besides, the rest of the pro/epilogue code uses r12 (david
>> suggested i use it).  if you are tripping this with vrsave,
>> it just as likely will be tripped with other pro/epilogue code.
>
> The bug is pretty obvious if you'd care to take a look at the code.
>
>       /* Save VRSAVE.  */
>       offset = info->vrsave_save_offset + sp_offset;
>       mem
> 	= gen_rtx_MEM (SImode,
> 		       gen_rtx_PLUS (Pmode, frame_reg_rtx, GEN_INT (offset)));
>       set_mem_alias_set (mem, rs6000_sr_alias_set);
>       insn = emit_move_insn (mem, reg);
>
> Note that we use frame_reg_rtx.  Further note that frame_reg_rtx may
> be set to r12 at the start of rs6000_emit_prologue, here:
>
>   rtx frame_ptr_rtx = gen_rtx_REG (Pmode, 12);
> [snip]
>   /* For V.4, update stack before we do any saving and set back 
> pointer.  */
>   if (info->push_p && DEFAULT_ABI == ABI_V4)
>     {
>       if (info->total_size < 32767)
> 	sp_offset = info->total_size;
>       else
> 	frame_reg_rtx = frame_ptr_rtx;
>
> So, ABI_V4, big stack frame, altivec vrsave -> zap random memory, boom.
>
> --
> Alan Modra
> IBM OzLabs - Linux Technology Centre
>
>
--
Aldy Hernandez                                E-mail: aldyh@redhat.com
Professional Gypsy Lost in Australia
Red Hat, Inc.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]