1 /* { dg-options "-O2" } */ 2 /* PR optimization/11536 */ 3 /* Origin: samal@kam.mff.cuni.cz <samal@kam.mff.cuni.cz> */ 4 /* Testcase by Andrew Pinski <pinskia@physics.uc.edu> */ 5 6 /* Verify that the loop optimizer doesn't use moving targets 7 to calculate the number of iterations of a loop. */ 8 9 extern void abort(void); 10 11 void foo(int) __attribute__((__noinline__)); 12 foo(int i)13void foo(int i) 14 { 15 abort(); 16 } 17 main()18int main() 19 { 20 int i; 21 int first= 0; 22 int last= 0; 23 24 while (last<3) { 25 last = first; 26 27 while (first<=last) { 28 first++; 29 30 for (i=0;i<3;i++) 31 last++; 32 33 if (last>10) 34 return 0; 35 } 36 37 foo(first); 38 } 39 40 return 0; 41 } 42