2015-01-15 Sandra Loosemore <sandra@codesourcery.com>
[official-gcc.git] / gcc / testsuite / gcc.target / nios2 / gpopt-global.c
blob1bb608efa7f00b66df5b446bf2cfbb16adf48e8a
1 /* { dg-do compile } */
2 /* { dg-options "-O -mgpopt=global" } */
4 extern int a __attribute__ ((section (".sdata")));
5 static volatile int b __attribute__ ((section (".sdata"))) = 1;
6 extern int c __attribute__ ((section (".data")));
7 static volatile int d __attribute__ ((section (".data"))) = 2;
9 extern int e;
10 static volatile int f = 3;
12 volatile int g __attribute__ ((weak)) = 4;
14 extern int h[100];
15 static int i[100];
16 static int j[100] __attribute__ ((section (".sdata")));
18 typedef int (*ftype) (int);
19 extern int foo (int);
21 extern int bar (int, int*, int*, int*, ftype);
23 int baz (void)
25 return bar (a + b + c + d + e + f + g, h, i, j, foo);
28 /* { dg-final { scan-assembler "%gprel\\(a\\)" } } */
29 /* { dg-final { scan-assembler "%gprel\\(b\\)" } } */
30 /* { dg-final { scan-assembler-not "%gprel\\(c\\)" } } */
31 /* { dg-final { scan-assembler-not "%gprel\\(d\\)" } } */
32 /* { dg-final { scan-assembler "%gprel\\(e\\)" } } */
33 /* { dg-final { scan-assembler "%gprel\\(f\\)" } } */
34 /* { dg-final { scan-assembler "%gprel\\(g\\)" } } */
35 /* { dg-final { scan-assembler-not "%gprel\\(h\\)" } } */
36 /* { dg-final { scan-assembler-not "%gprel\\(i\\)" } } */
37 /* { dg-final { scan-assembler "%gprel\\(j\\)" } } */
38 /* { dg-final { scan-assembler-not "%gprel\\(foo\\)" } } */