This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: New flag: TREE_THIS_NOTRAP
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.