From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20467 invoked by alias); 28 Nov 2007 13:07:17 -0000 Received: (qmail 20381 invoked by uid 22791); 28 Nov 2007 13:07:16 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 28 Nov 2007 13:07:10 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id C15B598244; Wed, 28 Nov 2007 13:07:08 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id A9AD198243; Wed, 28 Nov 2007 13:07:08 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.68) (envelope-from ) id 1IxMd8-0003Nx-MS; Wed, 28 Nov 2007 08:07:06 -0500 Date: Wed, 28 Nov 2007 13:07:00 -0000 From: Daniel Jacobowitz To: Paul Hilfinger Cc: gdb@sourceware.org Subject: Re: Strange case for expect_type Message-ID: <20071128130706.GA12708@caradoc.them.org> Mail-Followup-To: Paul Hilfinger , gdb@sourceware.org References: <20071128084549.E25BD48CC02@nile.gnat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20071128084549.E25BD48CC02@nile.gnat.com> User-Agent: Mutt/1.5.15 (2007-04-09) X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-11/txt/msg00255.txt.bz2 On Wed, Nov 28, 2007 at 03:45:49AM -0500, Paul Hilfinger wrote: > > Can anyone explain this code fragment from evaluate_subexp_standard? > > case UNOP_IND: > if (expect_type && TYPE_CODE (expect_type) == TYPE_CODE_PTR) > expect_type = TYPE_TARGET_TYPE (check_typedef (expect_type)); > arg1 = evaluate_subexp (expect_type, exp, pos, noside); > > It SEEMS to be saying that if I "expect" type T* from expression *E, then > I should expect type T from E. Say what? Thanks for any help. It's also got the logic of typedef checking wrong; you're supposed to check_typedef before using TYPE_CODE, not after. Doesn't make sense to me either. You can probably reach this code easiest by the function call case. argvec[tem] = evaluate_subexp (TYPE_FIELD_TYPE (type, tem - 1), exp, pos, noside); -- Daniel Jacobowitz CodeSourcery