From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8394 invoked by alias); 10 Dec 2009 19:04:18 -0000 Received: (qmail 8275 invoked by uid 22791); 10 Dec 2009 19:04:16 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS 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; Thu, 10 Dec 2009 19:04:12 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nBAJ4BIq018244 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 10 Dec 2009 14:04:11 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nBAJ4ARv013185; Thu, 10 Dec 2009 14:04:11 -0500 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 nBAJ49D6028141; Thu, 10 Dec 2009 14:04:10 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id 755BB3782A3; Thu, 10 Dec 2009 12:04:09 -0700 (MST) From: Tom Tromey To: Chris Moller Cc: gdb-patches@sourceware.org Subject: Re: Patch for PR 9399 References: <4B1FA6F2.1060105@redhat.com> <20091209140534.GA12330@caradoc.them.org> <4B1FBDF4.4040801@redhat.com> <20091210184102.GA16828@caradoc.them.org> Reply-To: tromey@redhat.com Date: Thu, 10 Dec 2009 19:04:00 -0000 In-Reply-To: <20091210184102.GA16828@caradoc.them.org> (Daniel Jacobowitz's message of "Thu, 10 Dec 2009 13:41:03 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (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: 2009-12/txt/msg00147.txt.bz2 >>>>> "Daniel" == Daniel Jacobowitz 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