1 /* { dg-do compile } */
2 /* { dg-require-weak "" } */
3 /* { dg-options "-fno-common" } */
4 /* { dg-skip-if "" { x86_64-*-mingw* } { "*" } { "" } } */
5 
6 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1a" } } */
7 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1b" } } */
8 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1c" } } */
9 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1d" } } */
10 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1e" } } */
11 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1f" } } */
12 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1g" } } */
13 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1h" } } */
14 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1i" } } */
15 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1j" } } */
16 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1k" } } */
17 
18 /* test variable addresses with #pragma weak */
19 
20 #pragma weak vfoo1a
21 extern int vfoo1a;
foo1a(void)22 void * foo1a (void)
23 {
24   return (void *)&vfoo1a;
25 }
26 
27 
28 extern int vfoo1b;
29 #pragma weak vfoo1b
foo1b(void)30 void * foo1b (void)
31 {
32   return (void *)&vfoo1b;
33 }
34 
35 
36 extern int vfoo1c;
foo1c(void)37 void * foo1c (void)
38 {
39   return (void *)&vfoo1c;
40 }
41 #pragma weak vfoo1c
42 
43 
44 #pragma weak vfoo1d
45 int vfoo1d;
foo1d(void)46 void * foo1d (void)
47 {
48   return (void *)&vfoo1d;
49 }
50 
51 
52 int vfoo1e;
53 #pragma weak vfoo1e
foo1e(void)54 void * foo1e (void)
55 {
56   return (void *)&vfoo1e;
57 }
58 
59 
60 int vfoo1f;
foo1f(void)61 void * foo1f (void)
62 {
63   return (void *)&vfoo1f;
64 }
65 #pragma weak vfoo1f
66 
67 
68 extern int vfoo1g;
foo1g(void)69 void * foo1g (void)
70 {
71   return (void *)&vfoo1g;
72 }
73 #pragma weak vfoo1g
74 int vfoo1g;
75 
76 
77 extern int vfoo1h;
foo1h(void)78 void * foo1h (void)
79 {
80   return (void *)&vfoo1h;
81 }
82 int vfoo1h;
83 #pragma weak vfoo1h
84 
85 
86 int vfoo1i;
87 extern int vfoo1i;
foo1i(void)88 void * foo1i (void)
89 {
90   return (void *)&vfoo1i;
91 }
92 #pragma weak vfoo1i
93 
94 
95 extern int vfoo1j;
96 int vfoo1j;
foo1j(void)97 void * foo1j (void)
98 {
99   return (void *)&vfoo1j;
100 }
101 #pragma weak vfoo1j
102 
103 
104 #pragma weak vfoo1k
105 int vfoo1k = 1;
106 
107