summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/pr37508.c
blob: 2ba09afe4819e622e34798dcbe935a184fe39e77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* { dg-do compile } */
/* { dg-options "-O2 -fno-tree-fre -fdump-tree-vrp1" } */

struct foo1 {
  int i:1;
};
struct foo2 {
  unsigned i:1;
};

int test1 (struct foo1 *x)
{
  int i = x->i;
  if (i == 0)
    return 1;
  else if (i == -1)
    return 1;
  return 0;
}

int test2 (struct foo2 *x)
{
  if (x->i == 0)
    return 1;
  else if (x->i == -1) /* This test is already folded to false by ccp1.  */
    return 1;
  return 0;
}

int test3 (struct foo1 *x)
{
  if (x->i == 0)
    return 1;
  else if (x->i == 1) /* This test is already folded to false by fold.  */
    return 1;
  return 0;
}

int test4 (struct foo2 *x)
{
  unsigned int i = x->i;
  if (i == 0)
    return 1;
  else if (i == 1)
    return 1;
  return 0;
}

/* { dg-final { scan-tree-dump-times "if" 2 "vrp1" } } */