public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Strange case for expect_type
@ 2007-11-28  8:45 Paul Hilfinger
  2007-11-28 13:07 ` Daniel Jacobowitz
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Hilfinger @ 2007-11-28  8:45 UTC (permalink / raw)
  To: gdb


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.

Paul Hilfinger

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Strange case for expect_type
  2007-11-28  8:45 Strange case for expect_type Paul Hilfinger
@ 2007-11-28 13:07 ` Daniel Jacobowitz
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2007-11-28 13:07 UTC (permalink / raw)
  To: Paul Hilfinger; +Cc: gdb

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-11-28 13:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-28  8:45 Strange case for expect_type Paul Hilfinger
2007-11-28 13:07 ` Daniel Jacobowitz

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).