From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15130 invoked by alias); 24 Nov 2003 17:23:20 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 15123 invoked from network); 24 Nov 2003 17:23:19 -0000 Received: from unknown (HELO hawaii.kealia.com) (209.3.10.89) by sources.redhat.com with SMTP; 24 Nov 2003 17:23:19 -0000 Received: by hawaii.kealia.com (Postfix, from userid 2049) id 456A3C6B6; Mon, 24 Nov 2003 09:23:18 -0800 (PST) To: mec.gnu@mindspring.com (Michael Elizabeth Chastain) Cc: gdb-patches@sources.redhat.com Subject: Re: [patch/testsuite/c++] test script for PR c++/186 References: <20031123220445.1F77C4B409@berman.michael-chastain.com> From: David Carlton Date: Mon, 24 Nov 2003 17:23:00 -0000 In-Reply-To: <20031123220445.1F77C4B409@berman.michael-chastain.com> (Michael Elizabeth Chastain's message of "Sun, 23 Nov 2003 17:04:45 -0500 (EST)") Message-ID: User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Rational FORTRAN, linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-11/txt/msg00523.txt.bz2 On Sun, 23 Nov 2003 17:04:45 -0500 (EST), mec.gnu@mindspring.com (Michael Elizabeth Chastain) said: > The issue is that the user is accessing a destroyed object through a > pointer. Because the object has been destroyed, its vptr has been > degraded to its most primitive base class. gdb gets confused and > prints incorrect data, which is always wrong. I wouldn't necessarily call this incorrect/wrong, but it is somewhat unfortunate. I confess, though, that the correct fix isn't at all obvious to me, given that normally the dynamic type is more useful than the static type. Should GDB try to somehow take the supremum of the static type and the dynamic type? (And what if there is no supremum?) Should GDB try to remember when the user explicitly casts? (If so, exactly how do we want to remember that?) Should there be an option to turn of RTTI usage? (But users won't know about that.) Maybe the best thing to do would be as follows, if A is the dynamic type and B is the static type, then we check to make sure that A is more specialized than B. If so, we use A; otherwise, we print a warning and use B. I can't remember offhand if we have a way to calculate whether or not A is more specialized with B, but it shouldn't be too hard to do. David Carlton carlton@kealia.com