On Tue, 2006-02-21 at 17:22 -0500, Richard Kenner wrote: > Given an expression, we have to do computations in some other type than > the type of the expression? Now that's just silly. > > Sure, but that's not what I said. > > If the expression has some type X, then we should be doing our > computations in type X. > > Right. > > Let me try again and take a simpler example. If we have > > subtype T is Integer range 20..50; > > Y: T; > > ... Y + 1 ... > > What the tree looks like is a PLUS_EXPR of type "Integer" (the base type of > T), not T, whose first operand is a NOP_EXPR converting Y to Integer and > whose second operand is the constant 1 also of type Integer, not T. In a gimplified tree, for nodes such as PLUS_EXPR, the type of the inputs, the type of the expression and the type of the result are all one and the same. Any input conversions occur before the arithmetic statement and any output conversions occur after the arithmetic statement. ie, within the statement we are type consistent. I think we're in agreement about that.
When I speak about doing arithmetic in a type, I'm referring to the type of the expression & its input operands in a gimplified expression. At that point I do not care about base types or anything like that. All that should matter is TREE_TYPE (expr), nothing more, nothing less. How the inputs are converted or how the output is later converted is not a concern -- all that matters is TREE_TYPE (expr) in a gimplified tree. Can we agree on that? jef