[Bug fortran/51218] [4.6/4.7 Regression] Potential optimization bug due to implicit_pure?

tkoenig at netcologne dot de gcc-bugzilla@gcc.gnu.org
Sat Nov 26 12:15:00 GMT 2011


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

--- Comment #26 from tkoenig at netcologne dot de <tkoenig at netcologne dot de> 2011-11-26 09:22:15 UTC ---
Am 25.11.2011 18:44, schrieb burnus at gcc dot gnu.org:
> 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.

I'l defer to authority here :-)

To quote Dick Hendrickson in the thread

ttps://groups.google.com/group/comp.lang.fortran/browse_thread/thread/6dfe2c3088f89725/3f69c230c86db253?hl=de&ie=UTF-8&q=functions+*+side+effects+group:comp.lang.fortran+author:Thomas+author:Koenig#3f69c230c86db253

# In this case, I think the standard is clear.  The processor is
# allowed to evaluate f(3) once or twice.  By the words
# Richard quoted, a function is not allowed to affect or be
# affected by anything else in the statement.  So, one evaluation
# of f(3) can't change the result of the other, and the processor
# is free to evaluate f(3) + f(3) as 2*f(3).  It
# is processor dependent.

Richard Maine sort of disagreed, he thinks the program is illegal.

So, either way, optimizing away a function call would be OK.



More information about the Gcc-bugs mailing list