From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29356 invoked by alias); 28 Jul 2010 19:59:49 -0000 Received: (qmail 29347 invoked by uid 22791); 28 Jul 2010 19:59:48 -0000 X-SWARE-Spam-Status: No, hits=-5.2 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_SV,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; Wed, 28 Jul 2010 19:59:30 +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 o6SJx7OZ002593 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 28 Jul 2010 15:59:07 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o6SJx7tc021406; Wed, 28 Jul 2010 15:59:07 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o6SJx6LH013190; Wed, 28 Jul 2010 15:59:06 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id EAE263792BB; Wed, 28 Jul 2010 13:59:05 -0600 (MDT) From: Tom Tromey To: Joel Brobecker Cc: gdb-patches@sourceware.org Subject: Re: RFC: fix another regression w/ gcc svn trunk References: <20100728174456.GQ13267@adacore.com> Date: Wed, 28 Jul 2010 19:59:00 -0000 In-Reply-To: <20100728174456.GQ13267@adacore.com> (Joel Brobecker's message of "Wed, 28 Jul 2010 10:44:56 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-07/txt/msg00514.txt.bz2 >>>>> "Joel" == Joel Brobecker writes: Joel> This looks reasonable to me. For 7.2, I'm also 50/50, so I propose Joel> the following compromise: Since it is mostly affecting an unreleased Joel> version of GCC, we can leave this out of 7.2, and reconsider for 7.2.1 Joel> after an observation period on the head? Sounds reasonable to me. >> +/* Given an attr with a DW_FORM_dataN value in host byte order, >> + zero-extend it as appropriate for the symbol's type. */ Joel> I think it would be nice to explain in the comment the reason for Joel> zero-extending as opposed to sign-extending? Good idea. I have appended what I am checking in. Tom 2010-07-27 Tom Tromey * dwarf2read.c (dwarf2_const_value_data): Never sign extend. Index: dwarf2read.c =================================================================== RCS file: /cvs/src/src/gdb/dwarf2read.c,v retrieving revision 1.430 diff -u -r1.430 dwarf2read.c --- dwarf2read.c 28 Jul 2010 16:23:58 -0000 1.430 +++ dwarf2read.c 28 Jul 2010 19:58:30 -0000 @@ -10446,8 +10446,13 @@ } -/* Given an attr with a DW_FORM_dataN value in host byte order, sign- - or zero-extend it as appropriate for the symbol's type. */ +/* Given an attr with a DW_FORM_dataN value in host byte order, + zero-extend it as appropriate for the symbol's type. The DWARF + standard (v4) is not entirely clear about the meaning of using + DW_FORM_dataN for a constant with a signed type, where the type is + wider than the data. The conclusion of a discussion on the DWARF + list was that this is unspecified. We choose to always zero-extend + because that is the interpretation long in use by GCC. */ static void dwarf2_const_value_data (struct attribute *attr, struct symbol *sym, @@ -10456,12 +10461,7 @@ LONGEST l = DW_UNSND (attr); if (bits < sizeof (l) * 8) - { - if (TYPE_UNSIGNED (SYMBOL_TYPE (sym))) - l &= ((LONGEST) 1 << bits) - 1; - else - l = (l << (sizeof (l) * 8 - bits)) >> (sizeof (l) * 8 - bits); - } + l &= ((LONGEST) 1 << bits) - 1; SYMBOL_VALUE (sym) = l; SYMBOL_CLASS (sym) = LOC_CONST;