aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-12.c
blob: 8ee9eb8d0e4b7c49e8cd820876869ac2e48ac86c (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
/* { dg-do run } */ 
/* { dg-options "-O2" } */

struct A
{
  int a;
  int b;
};

struct A a;
const int B = 42;

void foo (int i)
{
  if (i > 10)
    a.a = 42;
  else
    {
      a.b = 21;
      a.a = a.b + 21;
    }

  /* This should be folded to 'if (0)' as a.a and B are both 42.  */
  if (a.a != B)
    link_error ();
}

main ()
{
  foo (3);
  return 0;
}