From: Tom Tromey <tromey@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: RFC: fix another regression w/ gcc svn trunk
Date: Wed, 28 Jul 2010 19:59:00 -0000 [thread overview]
Message-ID: <m37hkfml87.fsf@fleche.redhat.com> (raw)
In-Reply-To: <20100728174456.GQ13267@adacore.com> (Joel Brobecker's message of "Wed, 28 Jul 2010 10:44:56 -0700")
>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> 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 <tromey@redhat.com>
* 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;
prev parent reply other threads:[~2010-07-28 19:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-27 17:23 Tom Tromey
2010-07-28 17:45 ` Joel Brobecker
2010-07-28 19:59 ` Tom Tromey [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m37hkfml87.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).