summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/ipa/vrp4.c
blob: 941f80e00b23e702ee63c8006e6c9fb28a1c106e (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
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-ipa-cp-details -fdump-tree-vrp1" } */

static __attribute__((noinline, noclone))
int foo (int *p)
{
  if (!p)
    return 0;
  *p = 1;
}

struct st
{
  int a;
  int b;
};

int bar (struct st *s)
{

  if (!s)
    return 0;
  foo (&s->a);
  foo (&s->b);
}

/* { dg-final { scan-ipa-dump "Setting nonnull for 0" "cp" } } */
/* { dg-final { scan-tree-dump-times "if" 1 "vrp1" } } */