List Info

Thread: Strange case for expect_type




Strange case for expect_type
country flaguser name
United States
2007-11-28 02:45:49
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

Re: Strange case for expect_type
country flaguser name
United States
2007-11-28 07:07:06
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

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )