1  /* { dg-do compile } */
       2  /* { dg-options "-O2 -fdump-tree-lim2-details" } */
       3  
       4  int *l, *r;
       5  int test_func(void)
       6  {
       7    int i;
       8    int direction;
       9    static int pos;
      10  
      11    pos = 0;
      12    direction = 1;
      13  
      14    for ( i = 0; i <= 400; i++ )
      15      {
      16        if ( direction == 0 )
      17  	pos = l[pos];
      18        else
      19  	pos = r[pos];
      20  
      21        if ( pos == -1 )
      22  	{
      23  	  pos = 0;
      24  	  direction = !direction;
      25  	}
      26      }
      27    return i;
      28  }
      29  
      30  /* { dg-final { scan-tree-dump "Executing store motion of pos" "lim2" } } */