This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Make attribute functions pure
Laurent GUERBY wrote:
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.
Actually that's not clear ... it is definitely an ARG issue. If
there are no side effects, then obviously the call can be moved
around. The intention of the design was not to allow side effects,
so it is not really clear what transformations are or are not
allowed. I would guess the ARG would be inclined to be permissive,
i.e. to allow any optimization which would be valid in the absence
of side effects.
Laurent