1 // PR c++/26757
2 // { dg-do run }
3 // { dg-options "-O" }
4 
5 extern "C" void abort ();
6 
7 typedef struct A
8 {
9   int c;
10   int d;
11 } A;
12 
13 A *b;
14 
15 void
foo()16 foo ()
17 {
18   b->c++;
19   extern A *b;
20   b->d++;
21 
22 }
23 
24 void
bar()25 bar ()
26 {
27   if (b->d)
28     b->c++;
29 }
30 
31 
32 int
main()33 main ()
34 {
35   A a = { 0, 0 };
36   b = &a;
37   foo ();
38   bar ();
39   if (b->c != 2)
40     abort ();
41   if (b->d != 1)
42     abort ();
43   return 0;
44 }
45