From patchwork Tue Jun 14 18:26:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 100405 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 3682CB6F80 for ; Wed, 15 Jun 2011 04:26:58 +1000 (EST) Received: (qmail 4718 invoked by alias); 14 Jun 2011 18:26:57 -0000 Received: (qmail 4706 invoked by uid 22791); 14 Jun 2011 18:26:56 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, 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; Tue, 14 Jun 2011 18:26:37 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p5EIQaQB027560 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 14 Jun 2011 14:26:36 -0400 Received: from anchor.twiddle.net (vpn-238-5.phx2.redhat.com [10.3.238.5]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p5EIQaLB028762 for ; Tue, 14 Jun 2011 14:26:36 -0400 Message-ID: <4DF7A7DB.80700@redhat.com> Date: Tue, 14 Jun 2011 11:26:35 -0700 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc15 Thunderbird/3.1.10 MIME-Version: 1.0 To: GCC Patches Subject: fix pr48459 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 In this pr, during the initialization of the dwarf2 backend, we attempt to cache a translation from a local stack frame address to the CFA. We do this optimistically, hoping to cut down the work later for every local stack frame address that we find in the actual variables dumped. Unfortunately, AVR has problems with the edge condition of no local stack frame allocated. In this case, the results of its register elimination are different from what dwarf2out expects. IMO, AVR is justified in this, because the combination that dwarf2out wants is invalid according to TARGET_CAN_ELIMINATE. That said, this really shouldn't matter since, for the edge condition in question, we won't actually use the translation to the CFA. The moment that we generate an actual reference to the stack frame, we'll actually generate a frame pointer, and everything else will DTRT. Thus we can avoid the explosion by deferring the sanity check until the translation is actually used. Committed to HEAD; testing for 4.6 is still going. r~ diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 776066b..b33da64 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -6471,6 +6471,7 @@ static GTY(()) VEC(tree,gc) *generic_type_instances; /* Offset from the "steady-state frame pointer" to the frame base, within the current function. */ static HOST_WIDE_INT frame_pointer_fb_offset; +static bool frame_pointer_fb_offset_valid; static VEC (dw_die_ref, heap) *base_types; @@ -13613,6 +13614,7 @@ based_loc_descr (rtx reg, HOST_WIDE_INT offset, return new_reg_loc_descr (base_reg, offset); } + gcc_assert (frame_pointer_fb_offset_valid); offset += frame_pointer_fb_offset; return new_loc_descr (DW_OP_fbreg, offset, 0); } @@ -18336,14 +18338,20 @@ compute_frame_pointer_to_fb_displacement (HOST_WIDE_INT offset) elim = XEXP (elim, 0); } - gcc_assert ((SUPPORTS_STACK_ALIGNMENT - && (elim == hard_frame_pointer_rtx - || elim == stack_pointer_rtx)) - || elim == (frame_pointer_needed - ? hard_frame_pointer_rtx - : stack_pointer_rtx)); - frame_pointer_fb_offset = -offset; + + /* ??? AVR doesn't set up valid eliminations when there is no stack frame + in which to eliminate. This is because it's stack pointer isn't + directly accessible as a register within the ISA. To work around + this, assume that while we cannot provide a proper value for + frame_pointer_fb_offset, we won't need one either. */ + frame_pointer_fb_offset_valid + = ((SUPPORTS_STACK_ALIGNMENT + && (elim == hard_frame_pointer_rtx + || elim == stack_pointer_rtx)) + || elim == (frame_pointer_needed + ? hard_frame_pointer_rtx + : stack_pointer_rtx)); } /* Generate a DW_AT_name attribute given some string value to be included as