[Bug tree-optimization/19828] [4.0 Regression] LIM is pulling out a pure function even though there is something which can modify global memory

drow at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Feb 9 06:37:00 GMT 2005

------- 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:

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.



More information about the Gcc-bugs mailing list