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

Reply via email to