aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr108385.c
blob: 13babf06d9a479a749536b82d701a4333b12718d (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
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-evrp" } */

void bar(char *);

/* Ensure that PTR1 = PTR2 + OFF properly picks up the zero and non-zero
   properties if PTR1 and PTR2 are known equal or non-equal.  */

void foo1 (char *p, char *pp, int off)
{
  char *q = p + off;
  if (q != p)
    {
      if (off == 0)
	  bar (q);
    }
  else
    {
      if (off != 0)
        bar (p);
    }
}

void foo2 (char *p, char *pp, int off)
{
  char *q = p + off;
  if (q == p)
    {
      if (off != 0)
        bar (p);
    }
  else
    {
      if (off == 0)
	  bar (q);
    }
}

/* { dg-final { scan-tree-dump-not "bar" "evrp" } } */