http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51218

--- Comment #25 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-11-25 
17:44:29 UTC ---
(In reply to comment #24)
> > Thanks for the bugreport and the (valid)
> > testcase.
> 
> To be pedantic, the test case was not valid

Can you tell me what's wrong with the test case of comment 16? It looks
perfectly valid to me.

(One might argue about the result the program should print, i.e. whether a
compiler may optimize "a = f() + f()" to "a= 2*f()" even if "f" is impure. I
think the standard is a bit ambiguous about that one. But independently how one
decides, I fail to see how it makes the program invalid. [And I stand firmly on
the side that the compiler should not do this optimization (by default for any
-O... level). On the other hand, I am also in favour of pure functions and
prefer subroutines if the procedure is not pure.])

Reply via email to