1 /* { dg-do compile { target { nonpic } } } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
3 static int a;
4 int f;
5 void bar (void)  __attribute__((noinline));
bar(void)6 void bar (void)
7 {
8   f = 9;
9 }
10 
11 void link_error ();
12 
foo()13 int foo()
14 {
15   int b, c;
16   a = 5;
17   b = a;
18   bar ();
19   b = b + a;
20   if (b != 10)
21     link_error ();
22   return b;
23 }
24 
25 /* We should have removed the link_error on the tree level as GCC can tell that
26    a is not touched by the calling bar at all. */
27 /* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */
28