Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/pr78655.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fno-tree-ccp -fno-tree-forwprop -fno-tree-fre -fdump-tree-evrp" } */
3
4 struct A{int a,b;};
5 inline int*f1(struct A*p){return&p->a;} /* offset of 0. */
6 inline int*f2(struct A*p){return&p->b;} /* Offset of non-zero. */
7 inline int*g(struct A*p){return(int*)p+1;} /* Always non-zero offet. */
8
9 /* Should be able to eliminate all calls to bad(). */
10
11 void bad(void);
12
13 int
14 main()
15 {
16 struct A* ptr = 0;
17 struct A addr;
18
19 if (f1 (ptr) != 0)
20 bad();
21 if (f1 (&addr) == 0)
22 bad();
23
24 if (f2 (ptr) == 0)
25 bad();
26 if (f2 (&addr) == 0)
27 bad();
28
29 if (g (ptr) == 0)
30 bad();
31 if (g (&addr) == 0)
32 bad();
33
34 }
35
36 /* { dg-final { scan-tree-dump-not "bad" "evrp"} } */
37