1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdisable-tree-evrp -fdump-tree-vrp1 -fdump-tree-dce2 -fdelete-null-pointer-checks" } */
3 
4 int
foo(int * p)5 foo (int *p)
6 {
7   int a = *p;
8   int b = p != 0;
9 
10   *p = b;
11 
12   if (b)
13     return a;
14   else
15     return 0;
16 }
17 
18 /* Target disabling -fdelete-null-pointer-checks should not fold checks */
19 /* { dg-final { scan-tree-dump "Folding predicate " "vrp1" { target { ! keeps_null_pointer_checks } } } } */
20 /* { dg-final { scan-tree-dump-times "Folding predicate " 0 "vrp1" { target {   keeps_null_pointer_checks } } } } */
21