[M3devel] range analysis?
Hendrik Boom
hendrik at topoi.pooq.com
Mon May 23 14:41:53 CEST 2011
On Sun, May 22, 2011 at 11:18:02PM +0000, Jay K wrote:
>
> Well, I can build the whole tree and see how many times it helps.
> I think this is a pretty standard optimization technique.
> Though it'd work better with compiler-derived additional information.
>
> I initially happened upon this idea developing test cases.
>
> > The code assumes the minimum of a type is less than or equal to its maximum.
>
> I'll change it not have that problem -- to just fall back to usual pessimistic code for such types, I guess.
What *is* the semantics of a range whose minimum is greater than its
maximum? There plainly can't be any values in this range. How is a
variable of this tyoe initialized? Not to some arbitrary value of the
type, because there aren't any. I can see this type being useful to
admit convenient generalizations -- for example, an array with n
elements can still exist if n happens to be zero, but it seems to me
that any code involving a value of the range for subscripts for this
array must be simple unexecutable.
Or is there some latitude available in the principle that a value of a
variable must always be of the correct type?
-- hendrik
More information about the M3devel
mailing list