1 /* { dg-do compile } */
2 /* { dg-require-weak "" } */
3 /* { dg-options "-fno-common" } */
4 /* { dg-skip-if "" { *-*-mingw* } } */
5 /* NVPTX's definition of weak looks different to normal.  */
6 /* { dg-skip-if "" { nvptx-*-* } } */
7 
8 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?a" } } */
9 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?b" } } */
10 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?c" } } */
11 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?d" } } */
12 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?e" } } */
13 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?g" } } */
14 /* { dg-final { scan-assembler-not "weak\[^ \t\]*\[ \t\]_?i" } } */
15 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?j" } } */
16 
17 #pragma weak a
18 int a;
19 
20 int b;
21 #pragma weak b
22 
23 #pragma weak c
24 extern int c;
25 int c;
26 
27 extern int d;
28 #pragma weak d
29 int d;
30 
31 #pragma weak e
e(void)32 void e(void) { }
33 
34 #if 0
35 /* This permutation is illegal.  */
36 void f(void) { }
37 #pragma weak f
38 #endif
39 
40 #pragma weak g
41 int g = 1;
42 
43 #if 0
44 /* This permutation is illegal.  */
45 int h = 1;
46 #pragma weak h
47 #endif
48 
49 #pragma weak i
50 extern int i;
51 
52 #pragma weak j
53 extern int j;
use_j()54 int use_j() { return j; }
55