summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/tree-ssa/pr26757.C
blob: 4d124e3c45d6472689d5d8d35145caf1ac9d05ad (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
38
39
40
41
42
43
44
// PR c++/26757
// { dg-do run }
// { dg-options "-O" }

extern "C" void abort ();

typedef struct A
{
  int c;
  int d;
} A;

A *b;

void
foo ()
{
  b->c++;
  extern A *b;
  b->d++;

}

void
bar ()
{
  if (b->d)
    b->c++;
}


int
main ()
{
  A a = { 0, 0 };
  b = &a;
  foo ();
  bar ();
  if (b->c != 2)
    abort ();
  if (b->d != 1)
    abort ();
  return 0;
}