1 /* { dg-do compile } */
2 /* { dg-require-weak "" } */
3 /* { dg-options "-fno-common" } */
4 
5 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1a" } } */
6 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1b" } } */
7 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1c" } } */
8 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1d" } } */
9 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1e" } } */
10 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1f" } } */
11 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1g" } } */
12 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1h" } } */
13 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1i" } } */
14 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1j" } } */
15 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1k" } } */
16 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1l" } } */
17 
18 /* test variable addresses with __attribute__ ((weak)) */
19 
20 extern int vfoo1a __attribute__((weak));
21 extern int vfoo1a;
foo1a(void)22 void * foo1a (void)
23 {
24   return (void *)&vfoo1a;
25 }
26 
27 
28 extern int vfoo1b;
29 extern int vfoo1b __attribute__((weak));
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 extern int vfoo1c __attribute__((weak)); /* { dg-warning "unspecified behavior" } */
42 
43 
44 extern int vfoo1d __attribute__((weak));
45 int vfoo1d;
foo1d(void)46 void * foo1d (void)
47 {
48   return (void *)&vfoo1d;
49 }
50 
51 
52 int vfoo1e;
53 extern int vfoo1e __attribute__((weak));
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 extern int vfoo1f __attribute__((weak)); /* { dg-warning "unspecified behavior" } */
66 
67 
68 extern int vfoo1g;
foo1g(void)69 void * foo1g (void)
70 {
71   return (void *)&vfoo1g;
72 }
73 int vfoo1g __attribute__((weak)); /* { dg-warning "unspecified behavior" } */
74 
75 
76 extern int vfoo1h __attribute__((weak));
foo1h(void)77 void * foo1h (void)
78 {
79   return (void *)&vfoo1h;
80 }
81 extern int vfoo1h __attribute__((weak));
82 int vfoo1h;
83 
84 
85 extern int vfoo1i __attribute__((weak));
foo1i(void)86 void * foo1i (void)
87 {
88   return (void *)&vfoo1i;
89 }
90 extern int vfoo1i __attribute__((weak));
91 extern int vfoo1i;
92 
93 
94 extern int vfoo1j __attribute__((weak));
foo1j(void)95 void * foo1j (void)
96 {
97   return (void *)&vfoo1j;
98 }
99 extern int vfoo1j;
100 extern int vfoo1j __attribute__((weak));
101 
102 
103 extern int vfoo1k __attribute__((weak));
104 int vfoo1k = 1;
105 
106 
107 int vfoox1l = 1;
108 extern int vfoo1l __attribute__((weak, alias ("vfoox1l")));
109