This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH]: CALL_EXPR should set TREE_SIDE_EFFECTS
On Fri, 2003-08-22 at 10:59, Nathan Sidwell wrote:
> Jason Merrill wrote:
> > On Fri, 22 Aug 2003 09:37:45 +0100, Nathan Sidwell <nathan@codesourcery.com> wrote:
> >
> >
> >>In tracking down the regressions I'v caused in C++ wrt no-effect
> >>expressions, I discovered that building a CALL_EXPR does not automatically
> >>set TREE_SIDE_EFFECTS. Both C & C++ frontends set it explicitly immediately
> >>afterwards (but C++ forgets a few places).
> >
> >
> > 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?
I agree that a CALL_EXPR should not have TREE_SIDE_EFFECTS set if it has
no side-effects.
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com