This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Make attribute functions pure


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]