This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Make attribute functions pure
* Robert Dewar:
> As I said in my previous message, the original intention was that
> pure functions should not be able to have side effects. So the
> original intention is that all these transformations would be valid.
The AARM seems to agree with Laurent. The section is not marked as
redundant (which means that it's not implied by the as-if rule), and
the Discussion section explicitly mentions some of the pathological
cases (or loopholes):
| Discussion: A declared-pure library_item has no variable
| state. Hence, a call on one of its (nonnested) subprograms cannot
| ``normally'' have side effects. The only possible side effects from
| such a call would be through machine code insertions, unchecked
| conversion to an access type declared within the subprogram, and
| similar features. The compiler may omit a call to such a subprogram
| even if such side effects exist, so the writer of such a subprogram
| has to keep this in mind.