1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fno-tree-fre -fdump-tree-vrp1" } */
3
4 struct foo1 {
5 int i:1;
6 };
7 struct foo2 {
8 unsigned i:1;
9 };
10
test1(struct foo1 * x)11 int test1 (struct foo1 *x)
12 {
13 int i = x->i;
14 if (i == 0)
15 return 1;
16 else if (i == -1)
17 return 1;
18 return 0;
19 }
20
test2(struct foo2 * x)21 int test2 (struct foo2 *x)
22 {
23 if (x->i == 0)
24 return 1;
25 else if (x->i == -1) /* This test is already folded to false by ccp1. */
26 return 1;
27 return 0;
28 }
29
test3(struct foo1 * x)30 int test3 (struct foo1 *x)
31 {
32 if (x->i == 0)
33 return 1;
34 else if (x->i == 1) /* This test is already folded to false by fold. */
35 return 1;
36 return 0;
37 }
38
test4(struct foo2 * x)39 int test4 (struct foo2 *x)
40 {
41 unsigned int i = x->i;
42 if (i == 0)
43 return 1;
44 else if (i == 1)
45 return 1;
46 return 0;
47 }
48
49 /* { dg-final { scan-tree-dump-times "if" 2 "vrp1" } } */
50