From: Tom Tromey <tromey@redhat.com>
To: Chris Moller <cmoller@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: Patch for PR 9399
Date: Thu, 10 Dec 2009 19:04:00 -0000 [thread overview]
Message-ID: <m3vdge3b2u.fsf@fleche.redhat.com> (raw)
In-Reply-To: <20091210184102.GA16828@caradoc.them.org> (Daniel Jacobowitz's message of "Thu, 10 Dec 2009 13:41:03 -0500")
>>>>> "Daniel" == Daniel Jacobowitz <drow@false.org> writes:
Daniel> Tom's approved this. That's fine.
I'm open to unapproving it if you think it is incorrect.
I don't want to paper over a bug.
>> value_cast_structs only does nothing if both TYPE_NAME()s are null.
>> I was wondering if, back when the code was originally written, if
>> there never was a case when both TYPE_NAME()s were non-null--it's the
>> only way, other than simple oversight, I can account for that case
>> not being covered.
Daniel> No, it looks exactly like I intended. If we have two classes, we
Daniel> check if A is a base class of B, then if B is a base class of A.
Daniel> If A == B, neither of those checks will be true, and we'll return
Daniel> without doing anything.
Daniel> So the problem is that one of those base class checks is calling
Daniel> error(). That's not supposed to happen.
I think from value_cast_structs:
/* Downcasting: look in the type of the target to see if it contains the
type of the source as a superclass. If so, we'll need to
offset the pointer rather than just change its type.
FIXME: This fails silently with virtual inheritance. */
... but this doesn't fail silently, it tries to dereference NULL, due to
the use of value_zero. IIRC.
The reason I approved this is that it seems strange to me to try to do
any cast when we can tell beforehand that it is not needed. It is doing
a lot of work for no reason.
Also, I tried a little to write a different test that would still hit
this failure, and I couldn't. I don't know if Chris tried this or not.
Tom
next prev parent reply other threads:[~2009-12-10 19:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-09 13:32 Chris Moller
2009-12-09 14:05 ` Daniel Jacobowitz
2009-12-09 15:10 ` Chris Moller
2009-12-10 18:41 ` Daniel Jacobowitz
2009-12-10 19:04 ` Tom Tromey [this message]
2009-12-10 19:09 ` Chris Moller
2009-12-10 19:13 ` Daniel Jacobowitz
2009-12-10 16:59 ` Tom Tromey
2009-12-10 18:33 ` Chris Moller
2009-12-10 18:55 ` Tom Tromey
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=m3vdge3b2u.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=cmoller@redhat.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