| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-tree-evrp" } */ |
| 3 |
|
| 4 |
void bar(char *); |
| 5 |
|
| 6 |
/* Ensure that PTR1 = PTR2 + OFF properly picks up the zero and non-zero |
| 7 |
properties if PTR1 and PTR2 are known equal or non-equal. */ |
| 8 |
|
| 9 |
void foo1 (char *p, char *pp, int off) |
| 10 |
{ |
| 11 |
char *q = p + off; |
| 12 |
if (q != p) |
| 13 |
{ |
| 14 |
if (off == 0) |
| 15 |
bar (q); |
| 16 |
} |
| 17 |
else |
| 18 |
{ |
| 19 |
if (off != 0) |
| 20 |
bar (p); |
| 21 |
} |
| 22 |
} |
| 23 |
|
| 24 |
void foo2 (char *p, char *pp, int off) |
| 25 |
{ |
| 26 |
char *q = p + off; |
| 27 |
if (q == p) |
| 28 |
{ |
| 29 |
if (off != 0) |
| 30 |
bar (p); |
| 31 |
} |
| 32 |
else |
| 33 |
{ |
| 34 |
if (off == 0) |
| 35 |
bar (q); |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
/* { dg-final { scan-tree-dump-not "bar" "evrp" } } */ |