> > On irc today we were discussing handling 'this' in gcj.  We can add an
> > attribute to the argument to mark it as non-null... but strangely
> > there doesn't seem to be a way to mark other local variables as
> > known-non-null -- a curious deficiency.
> It seems to me that for other locals that the non-null property
> ought to be a property of how those locals are assigned a value.
> ie, if we're going to be able to derive a non-null for a local we
> should be able to derive it from the RHS of the assignment(s) to
> that local.
>
> IIRC "this" is actually a parameter and thus there's no assignment
> we can derive information from.

Ada has a notion of "non-null pointer type".  A variable declared
to be of such a type is required to have a non-null initial value,
so VRP can presumably work out that it is non-null from the initialization.
The main interest of such a type is in declaring subroutine parameters and
function return values, in which case the existing attribute is likely
good enough.  So the Ada way of handling these types maps pretty well to
what you said.

Ciao,

Duncan.

Reply via email to