This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Make attribute functions pure
- From: Laurent GUERBY <laurent at guerby dot net>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>, paul at codesourcery dot com, gcc-patches at gcc dot gnu dot org, gcc at gcc dot gnu dot org
- Date: Fri, 23 Jul 2004 19:13:57 +0200
- Subject: Re: [PATCH] Make attribute functions pure
- References: <10407231255.AA27336@vlsi1.ultra.nyu.edu> <20040723111335.GU30497@sunsite.ms.mff.cuni.cz>
On Fri, 2004-07-23 at 13:13, Jakub Jelinek wrote:
> recog_memoized is pure and you do:
>
> recog_memoized (insn);
> ...
> code = INSN_CODE (insn);
>
> then the compiler is allowed to reorder these, so that INSN_CODE (insn)
> is first read and then recog_memoized is called.
> I believe if you don't use the return value of recog_memoized,
> the compiler is allowed not to call the function at all.
Interesting, I assume GNAT is not mapping the Ada pragma Pure
to the same thing as the GNU C pure attribute, since Ada
semantics allow the compiler only to remove a call to a Pure function
(reusing previous call result when arguments are provably not changing),
not to move it around. Otherwise it's a bug.
Laurent