diff options
author | Tom Tromey <tromey@redhat.com> | 2010-07-28 20:05:03 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2010-07-28 20:05:03 +0000 |
commit | 053315c2134b7832b351c599fa3fa11abf6ca4e7 (patch) | |
tree | 14e668d7fa467a638259da54bcdff0ccb8d0d682 /gdb/dwarf2read.c | |
parent | 3ce3b1ba3153a2fc9265ba78cc25acaa7db127ba (diff) | |
download | gdb-053315c2134b7832b351c599fa3fa11abf6ca4e7.zip gdb-053315c2134b7832b351c599fa3fa11abf6ca4e7.tar.gz gdb-053315c2134b7832b351c599fa3fa11abf6ca4e7.tar.bz2 |
* dwarf2read.c (dwarf2_const_value_data): Never sign extend.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r-- | gdb/dwarf2read.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 7a0da0e..9eb7466 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -10485,8 +10485,13 @@ dwarf2_const_value (struct attribute *attr, struct symbol *sym, } -/* 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, @@ -10495,12 +10500,7 @@ dwarf2_const_value_data (struct attribute *attr, 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; |