2017-12-05 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / 20030721-1.c
blob5e8ed0b434adb202d9c179c20888a9a90430b66b
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> */
6 /* Verify that the loop optimizer doesn't use moving targets
7 to calculate the number of iterations of a loop. */
9 extern void abort(void);
11 void foo(int) __attribute__((__noinline__));
13 void foo(int i)
15 abort();
18 int main()
20 int i;
21 int first= 0;
22 int last= 0;
24 while (last<3) {
25 last = first;
27 while (first<=last) {
28 first++;
30 for (i=0;i<3;i++)
31 last++;
33 if (last>10)
34 return 0;
37 foo(first);
40 return 0;