This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/19828] [4.0 Regression] LIM is pulling out a pure function even though there is something which can modify global memory
- From: "drow at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Feb 2005 19:36:08 -0000
- Subject: [Bug tree-optimization/19828] [4.0 Regression] LIM is pulling out a pure function even though there is something which can modify global memory
- References: <20050208190328.19828.pinskia@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From drow at gcc dot gnu dot org 2005-02-08 19:36 -------
Here's another one. This may be a different bug. Suppose we have two pure
functions, one which checks whether a library is present and one which fetches
some piece of data from the library. Code looks like this:
int
func_loop_3 (int arg)
{
int var = 0;
while (arg--)
{
if (func_pure ())
var = func_pure_2 ();
}
return var;
}
LIM will move _both_ pure calls out of the loop. I think that it is valid
for a pure call to segfault in a condition when it would not normally have
been called; if the implementation of func_pure always returns zero, I don't
think that func_pure_2 should ever be called in the above.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19828