This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] 2 patches for PR tree-optimization/34648
On Jan 18, 2008 9:23 AM, Richard Kenner <kenner@vlsi1.ultra.nyu.edu> wrote:
> > > Are you
> > > saying that it's invalid for a programmer to declare a function pure if it
> > > uses memoization?
> >
> > Yes. See http://thread.gmane.org/gmane.comp.gcc.patches/68255 (you
> > disagreed in that thread, too).
>
> Interesting. As Laurent Guerby points out in that thread, Ada permits
> Pure functions to be memoized.
>
The disconnect between various ideas of const/pure (in languages,
math, etc) is one of the reasons i've pushed for us to simply have a
set of attributes that make up pure/const (IE no_side_effects,
no_memory_reads, etc) and have pure/const in each language simply set
the right ones.
Right now we try to carry some idea of pure/const into the middle-end
(through DECL_PURE/etc), and nobody is ever really truly sure what
pure/const actually mean (we seem to have a thread every 5-6 months
about it). We should just transform it into a bitmask of separate
attributes.
--Dan