From patchwork Thu Sep 2 21:40:14 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Fix output_set_got vs. barrier_args_size (PR middle-end/45484) Date: Thu, 02 Sep 2010 11:40:14 -0000 From: Jakub Jelinek X-Patchwork-Id: 63558 Message-Id: <20100902214014.GW1269@tyan-ft48-01.lab.bos.redhat.com> To: gcc-patches@gcc.gnu.org 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 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 --- 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); }