Patchwork Fix output_set_got vs. barrier_args_size (PR middle-end/45484)

login
register
mail settings
Submitter Jakub Jelinek
Date Sept. 2, 2010, 9:40 p.m.
Message ID <20100902214014.GW1269@tyan-ft48-01.lab.bos.redhat.com>
Download mbox | patch
Permalink /patch/63558/
State New
Headers show

Comments

Jakub Jelinek - Sept. 2, 2010, 9:40 p.m.
Hi!

If output_set_got does a call, it calls dwarf2out_frame_debug with a barrier
to ensure all queued .eh_frame/.debug_frame register saves are flushed
before the call.  Unfortunately, BARRIER was a bad choice of an insn,
because dwarf2out_notice_stack_adjust for BARRIERs tries to look its
INSN_UID in barrier_args_size array, but as that BARRIER is created on the
fly, it is beyond the size of the array.  We don't want to adjust args_size
at that point in any way.  Fixed by using a different insn that
causes the flushing as well:
  if (!NONJUMP_INSN_P (insn) || clobbers_queued_reg_save (insn))
    flush_queued_reg_saves ();
but doesn't have any other side-effects in dwarf2out_frame_debug.
Bootstrapped/regtested on x86_64-linux and i686-linux.
Ok for trunk and 4.5?

2010-09-02  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/45484
	* config/i386/i386.c (output_set_got): Use a dummy JUMP_INSN instead
	of BARRIER for flushing of queued register saves.


	Jakub
Richard Henderson - Sept. 3, 2010, 12:11 a.m.
On 09/02/2010 02:40 PM, Jakub Jelinek wrote:
>  	  rtx insn;
>  	  start_sequence ();
> -	  insn = emit_barrier ();
> +	  insn = emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, pc_rtx));
>  	  end_sequence ();
>  	  dwarf2out_frame_debug (insn, false);

Ug.  Wouldn't it be better simply to expose a dwarf2out routine
that flushes the queue, without dancing around fake insns?


r~

Patch

--- gcc/config/i386/i386.c.jj	2010-09-01 19:15:23.000000000 +0200
+++ gcc/config/i386/i386.c	2010-09-02 17:31:36.533646187 +0200
@@ -8122,7 +8122,7 @@  output_set_got (rtx dest, rtx label ATTR
 	{
 	  rtx insn;
 	  start_sequence ();
-	  insn = emit_barrier ();
+	  insn = emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, pc_rtx));
 	  end_sequence ();
 	  dwarf2out_frame_debug (insn, false);
 	}