111
|
1 /* { dg-do compile } */
|
|
2 /* { dg-options "-fno-strict-overflow -O2 -fdump-tree-optimized" } */
|
|
3
|
|
4 /* We cannot fold i > 0 because p->a - p->b can be larger than INT_MAX
|
|
5 and thus i can wrap. Dual of Wstrict-overflow-18.c */
|
|
6
|
|
7 struct c { unsigned int a; unsigned int b; };
|
|
8 extern void bar (struct c *);
|
|
9 int
|
|
10 foo (struct c *p)
|
|
11 {
|
|
12 int i;
|
|
13 int sum = 0;
|
|
14
|
|
15 for (i = 0; i < p->a - p->b; ++i)
|
|
16 {
|
|
17 if (i > 0)
|
|
18 sum += 2;
|
|
19 bar (p);
|
|
20 }
|
|
21 return sum;
|
|
22 }
|
|
23
|
|
24 /* { dg-final { scan-tree-dump "i_.* > 0" "optimized" } } */
|