1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdelete-null-pointer-checks -fisolate-erroneous-paths-attribute -fdump-tree-isolate-paths -fdump-tree-ccp3" } */
3 /* { dg-skip-if "" keeps_null_pointer_checks } */
4 
5 
6 extern void foo(void *) __attribute__ ((__nonnull__ (1)));
7 
8 int z;
9 
10 void
com(int a)11 com (int a)
12 {
13     foo (a == 42 ? &z  : (void *) 0);
14 }
15 
16 void
bar(void)17 bar (void)
18 {
19   foo ((void *)0);
20 }
21 
22 /* We testing that the path isolation code can take advantage of the
23    returns non-null attribute to isolate a path where NULL flows into
24    a return statement.
25 
26    We also verify that after isolation phi-cprop simplifies the
27    return statement so that it returns &z directly. */
28 /* { dg-final { scan-tree-dump-times "__builtin_trap" 2 "isolate-paths"} } */
29 /* { dg-final { scan-tree-dump-times "foo .&z.;" 1 "ccp3"} } */
30 
31 
32