summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/pr23086.c
blob: 206b92de147e5bf9b14ebbebee08cf9d33e196d8 (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
/* { dg-do run } */
/* { dg-options "-O -fdump-tree-optimized" } */

extern void link_error (void);
extern void abort (void);

int *t;
int __attribute__((noinline)) g(int *a)
{
  t = a;
  *a = 2;
}

void __attribute__((noinline)) f(int *a)
{
  int b;
  b = 1;
  g(&b);
  b = 2;
  *a = 1;
  if (b != 2)
    link_error();
}

int main(void)
{
  int t;
  f(&t);
  if (t != 1)
    abort ();
  return 0;
}

/* { dg-final { scan-tree-dump-not "link_error" "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */