This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


------- Additional Comments From drow at gcc dot gnu dot org  2005-02-08 19:27 -------
Here's another related testcase.  If you uncomment the store to global_int,
LIM will move only func_const out of the loop.  With them both commented
out, however, the pure call gets moved out of the loop.  func_other may
modify global memory, though, so the pure call can not be moved.

int func_pure (void) __attribute__ ((pure));
int func_const (void) __attribute__ ((const));
void func_other (int);
int global_int;

int
func_loop (int arg)
{
  while (arg--)
    {
//      global_int = arg;
      func_other (func_pure ());
    }
}

int
func_loop_2 (int arg)
{
  while (arg--)
    {
//      global_int = arg;
      func_other (func_const ());
    }
}


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]