[PATCH]: CALL_EXPR should set TREE_SIDE_EFFECTS

Jason Merrill jason@redhat.com
Mon Aug 25 04:34:00 GMT 2003


On 22 Aug 2003 11:50:22 -0700, Mark Mitchell <mark@codesourcery.com> wrote:

> On Fri, 2003-08-22 at 10:59, Nathan Sidwell wrote:
>> Jason Merrill wrote:

>> > On the tree-ssa branch we've adopted the convention that a call to a const
>> > function does not have TREE_SIDE_EFFECTS set.  This could stay limited to
>> > the optimizers, but it seems reasonable to warn about ignoring the return
>> > value of a call to a const function.
>> yeah, that seems reasonable too - and was my first thought about why it
>> wasn't being set in make_node. I can patch build to DTRT if you like
>
> Are "pure" functions threated like "const" functions?  A pure function
> does not have side-effects either, right?

A pure function can read arbitrary (non-volatile) memory, but cannot have
side-effects.  Currently we only clear TREE_SIDE_EFFECTS for const
functions; I remember discussing this, but I don't remember the rationale.
I agree (and remember thinking) that we should clear it for pure functions,
too.

Jason



More information about the Gcc-patches mailing list