Daily bump.
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / isolate-2.c
blobf5cd23ab24201f04070a58386d0dae3214cd4193
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdelete-null-pointer-checks -fisolate-erroneous-paths-attribute -fdump-tree-isolate-paths -fdump-tree-forwprop3" } */
3 /* { dg-skip-if "" keeps_null_pointer_checks } */
6 int z;
7 int y;
9 int * foo(int a) __attribute__((returns_nonnull));
10 int * bar(void) __attribute__((returns_nonnull));
12 int *
13 foo(int a)
16 switch (a)
18 case 0:
19 return &z;
20 default:
21 return (int *)0;
26 int *
27 bar (void)
29 return 0;
32 /* We testing that the path isolation code can take advantage of the
33 returns non-null attribute to isolate a path where NULL flows into
34 a return statement. We test this twice, once where the NULL flows
35 from a PHI, the second with an explicit return 0 in the IL.
37 We also verify that after isolation cprop simplifies the
38 return statement so that it returns &z directly. */
39 /* { dg-final { scan-tree-dump-times "__builtin_trap" 2 "isolate-paths"} } */
40 /* { dg-final { scan-tree-dump-times "return &z;" 1 "forwprop3"} } */