New flag: TREE_THIS_NOTRAP

Andrew Haley aph@redhat.com
Tue Jun 15 11:50:00 GMT 2004


Tom Tromey writes:
 > >>>>> "Andrew" == Andrew Haley <aph@redhat.com> writes:
 > 
 > rth> So the NOTRAP bit is on the pointer and not the INDIRECT_REF?
 > 
 > Andrew> It has to be doesn't it?  The trapping in
 > Andrew>    *exp
 > Andrew> is a property of exp, not a property of *.
 > 
 > Suppose for example we have a sequence of field assignments via a
 > local variable:
 > 
 >    point *var = ...;
 >    var->x = 1;
 >    var->y = 1;
 > 
 > The first `*var' might trap, but the second one can't.

I think that's true for Java, where we're not allowed to re-order
stores.

 > But in both cases wouldn't this be INDIRECT_REF<VAR_DECL> -- with the
 > same argument?

Yes.  But I've already been persuaded to attach the NOTRAP bit to the
INDIRECT_REF anyway.  This should probably become a type attribute, so
the above could be

    point *var = ...;
    var->x = 1;
    ((notrap point*)var)->y = 1;

I'm a bit lary of generating new types, though, because I want to
avoid a memory explosion.  It's perhaps worth experimenting with.
 
Andrew.



More information about the Gcc-patches mailing list