aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/pr78655.c
blob: e9158e072688e3dc741ac238f206ae3537f0d764 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* { dg-do compile } */
/* { dg-options "-O2 -fno-tree-ccp -fno-tree-forwprop -fno-tree-fre -fdump-tree-evrp" } */

struct A{int a,b;};
inline int*f1(struct A*p){return&p->a;}   /* offset of 0.  */
inline int*f2(struct A*p){return&p->b;}   /* Offset of non-zero.  */
inline int*g(struct A*p){return(int*)p+1;} /* Always non-zero offet.  */

/* Should be able to eliminate all calls to bad().  */
 
void bad(void);

int
main() 
{
  struct A* ptr = 0;
  struct A addr;

  if (f1 (ptr) != 0)
    bad();
  if (f1 (&addr) == 0)
    bad();

  if (f2 (ptr) == 0)
    bad();
  if (f2 (&addr) == 0)
    bad();
    
  if (g (ptr) == 0)
    bad();
  if (g (&addr) == 0)
    bad();
  
}

/* { dg-final { scan-tree-dump-not "bad" "evrp"} } */