From patchwork Mon Nov 15 20:13:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 71274 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 2EACFB70F4 for ; Tue, 16 Nov 2010 07:13:59 +1100 (EST) Received: (qmail 29117 invoked by alias); 15 Nov 2010 20:13:54 -0000 Received: (qmail 29087 invoked by uid 22791); 15 Nov 2010 20:13:53 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, TW_OV, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 15 Nov 2010 20:13:21 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oAFKDKdn029356 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 15 Nov 2010 15:13:20 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id oAFKDJch029304 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 15 Nov 2010 15:13:20 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (localhost.localdomain [127.0.0.1]) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4) with ESMTP id oAFKDJC3016126 for ; Mon, 15 Nov 2010 21:13:19 +0100 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id oAFKDIqd016124 for gcc-patches@gcc.gnu.org; Mon, 15 Nov 2010 21:13:18 +0100 Date: Mon, 15 Nov 2010 21:13:18 +0100 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [committed] Fix x86_64 ICE with very large stack frame (PR debug/46095) Message-ID: <20101115201318.GC29412@tyan-ft48-01.lab.bos.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi! I've committed following fix after bootstrap/regtest on x86_64-linux and i686-linux after approval in bugzilla from rth. The issue is that scheduler swaps movq %rsp, %rbx and movabsq $..., %r11 insns in the prologue and thus dwarf2out fragile logic fails to remember that %r11 holds an interesting value (and which one) for unwinding purposes. Fixed by describing the insn using REG_FRAME_RELATED_EXPR instead. 2010-11-15 Jakub Jelinek PR debug/46095 * config/i386/i386.c (pro_epilogue_adjust_stack): Instead of marking r11 set RTX_FRAME_RELATED_P if offset is too large for style < 0, add REG_FRAME_RELATED_EXPR. * gcc.target/i386/pr46095.c: New test. Jakub --- gcc/config/i386/i386.c.jj 2010-11-15 09:28:19.000000000 +0100 +++ gcc/config/i386/i386.c 2010-11-15 18:16:14.000000000 +0100 @@ -9418,6 +9418,7 @@ pro_epilogue_adjust_stack (rtx dest, rtx { struct machine_function *m = cfun->machine; rtx insn; + bool add_frame_related_expr = false; if (! TARGET_64BIT) insn = gen_pro_epilogue_adjust_stack_si_add (dest, src, offset); @@ -9438,7 +9439,7 @@ pro_epilogue_adjust_stack (rtx dest, rtx } insn = emit_insn (gen_rtx_SET (DImode, tmp, offset)); if (style < 0) - RTX_FRAME_RELATED_P (insn) = 1; + add_frame_related_expr = true; insn = gen_pro_epilogue_adjust_stack_di_add (dest, src, tmp); } @@ -9461,7 +9462,15 @@ pro_epilogue_adjust_stack (rtx dest, rtx RTX_FRAME_RELATED_P (insn) = 1; } else if (style < 0) - RTX_FRAME_RELATED_P (insn) = 1; + { + RTX_FRAME_RELATED_P (insn) = 1; + if (add_frame_related_expr) + { + rtx r = gen_rtx_PLUS (Pmode, src, offset); + r = gen_rtx_SET (VOIDmode, dest, r); + add_reg_note (insn, REG_FRAME_RELATED_EXPR, r); + } + } if (dest == stack_pointer_rtx) { --- gcc/testsuite/gcc.target/i386/pr46095.c.jj 2010-11-15 18:20:37.000000000 +0100 +++ gcc/testsuite/gcc.target/i386/pr46095.c 2010-11-15 18:18:58.000000000 +0100 @@ -0,0 +1,12 @@ +/* PR debug/46095 */ +/* { dg-do compile { target lp64 } } */ +/* { dg-options "-O -fschedule-insns2 -fno-omit-frame-pointer -fstack-protector" } */ + +extern void bar (char *); + +void +foo (void) +{ + char c[0x80000000UL]; + bar (c); +}