From patchwork Fri Mar 25 10:59:04 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 88370 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 0ECAB1007D3 for ; Fri, 25 Mar 2011 21:59:19 +1100 (EST) Received: (qmail 21757 invoked by alias); 25 Mar 2011 10:59:15 -0000 Received: (qmail 21739 invoked by uid 22791); 25 Mar 2011 10:59:14 -0000 X-SWARE-Spam-Status: No, hits=-6.4 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; Fri, 25 Mar 2011 10:59:07 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p2PAx7x7016480 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 25 Mar 2011 06:59:07 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p2PAx6wN024675 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 25 Mar 2011 06:59:06 -0400 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 p2PAx5N5012272; Fri, 25 Mar 2011 11:59:05 +0100 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id p2PAx56r012270; Fri, 25 Mar 2011 11:59:05 +0100 Date: Fri, 25 Mar 2011 11:59:04 +0100 From: Jakub Jelinek To: Richard Henderson , Jason Merrill Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix DW_OP_GNU_entry_value handling in .debug_loc duplicate removal Message-ID: <20110325105904.GX18914@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! While working on a patch I'll post momentarily, I've noticed two issues: 1) DW_OP_GNU_entry_value wasn't being handled by hash_loc_operands/compare_loc_operands, which means different entry values could be considered the same and a wrong location list could be used; the entry value patch was written way before that optimization has been added and I just forgot to adjust entry value patch when I've added that optimization 2) comparing GET_MODE_BITSIZE measured in bits with DWARF2_ADDR_SIZE measured in bytes is certainly wrong Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2011-03-25 Jakub Jelinek * dwarf2out.c (mem_loc_descriptor) : Compare mode size instead of bitsize with DWARF2_ADDR_SIZE. (hash_loc_operands, compare_loc_operands): Handle DW_OP_GNU_entry_value. Jakub --- gcc/dwarf2out.c.jj 2011-03-23 17:15:49.000000000 +0100 +++ gcc/dwarf2out.c 2011-03-24 11:16:07.000000000 +0100 @@ -14311,8 +14311,8 @@ mem_loc_descriptor (rtx rtl, enum machin && ((unsigned) INTVAL (XEXP (rtl, 1)) + (unsigned) INTVAL (XEXP (rtl, 2)) <= GET_MODE_BITSIZE (GET_MODE (rtl))) - && GET_MODE_BITSIZE (GET_MODE (rtl)) <= DWARF2_ADDR_SIZE - && GET_MODE_BITSIZE (GET_MODE (XEXP (rtl, 0))) <= DWARF2_ADDR_SIZE) + && GET_MODE_SIZE (GET_MODE (rtl)) <= DWARF2_ADDR_SIZE + && GET_MODE_SIZE (GET_MODE (XEXP (rtl, 0))) <= DWARF2_ADDR_SIZE) { int shift, size; op0 = mem_loc_descriptor (XEXP (rtl, 0), mode, @@ -23125,6 +23125,9 @@ hash_loc_operands (dw_loc_descr_ref loc, case DW_OP_GNU_implicit_pointer: hash = iterative_hash_object (val2->v.val_int, hash); break; + case DW_OP_GNU_entry_value: + hash = hash_loc_operands (val1->v.val_loc, hash); + break; default: /* Other codes have no operands. */ @@ -23282,6 +23285,8 @@ compare_loc_operands (dw_loc_descr_ref x && valx1->val_class == valy1->val_class && valx1->v.val_die_ref.die == valy1->v.val_die_ref.die && valx2->v.val_int == valy2->v.val_int; + case DW_OP_GNU_entry_value: + return compare_loc_operands (valx1->v.val_loc, valy1->v.val_loc); default: /* Other codes have no operands. */ return true;