This is the mail archive of the
mailing list for the elfutils project.
Re: incorrect signed data
- From: Josh Stone <jistone at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Wed, 05 Feb 2014 14:59:53 -0800
- Subject: Re: incorrect signed data
On 02/05/2014 09:36 AM, Josh Stone wrote:
> On 02/05/2014 03:44 AM, Mark Wielaard wrote:
>> On Tue, 2014-02-04 at 18:24 -0800, Josh Stone wrote:
>>> So now I'm not sure anything needs to change. At least dwarf_formsdata
>>> should stay as-is for gcc.
>> Are you sure? I think your original analysis is correct that
>> dwarf_formsdata () is wrong and really should sign-extend.
> No, see above; GCC wrote signed index 199 into a data1:199, so it would
> be wrong to sign-extend this. We're at the mercy of the producer.
Here's gdb precedent for the status quo, not sign-extending, in the
comment right before dwarf2_const_value_data in gdb/dwarf2read.c:
/* 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. */