1 /* { dg-do compile } */
2 /* Skipped on MIPS GNU/Linux target because __PIC__ can be
3 defined for executables as well as shared libraries. */
4 /* { dg-skip-if "" { *-*-darwin* hppa*64*-*-* mips*-*-linux* *-*-mingw* } } */
5 /* { dg-options "-O2 -fno-common -fdump-tree-optimized" } */
6
7 const int conststaticvariable;
8
f(void)9 int f(void)
10 {
11 return conststaticvariable;
12 }
13
14 /* There should be no reference for nonpic targets to
15 conststaticvariable as we should have inlined the 0. */
16 /* { dg-final { scan-tree-dump-times "conststaticvariable" 0 "optimized" { target { pie_enabled || nonpic } } } } */
17 /* { dg-final { scan-tree-dump-times "conststaticvariable" 1 "optimized" { target { { ! pie_enabled } && { ! nonpic } } } } } */
18