1 /* PR c/33925 - missing -Waddress with the address of an inline function
4 { dg-require-weak "" } */
6 extern inline int eifn (void);
7 extern inline int eifn_def (void) { return 0; }
9 static inline int sifn (void);
10 static inline int sifn_def (void) { return 0; }
12 inline int ifn (void);
13 inline int ifn_def (void) { return 0; }
15 extern __attribute__ ((weak
)) int ewfn (void);
16 extern __attribute__ ((weak
)) int ewfn_def (void) { return 0; }
18 __attribute__ ((weak
)) int wfn (void);
19 __attribute__ ((weak
)) int wfn_def (void) { return 0; }
21 static __attribute__((weakref ("ewfn"))) int swrfn (void);
23 void test_function_eqz (int *p
)
25 *p
++ = eifn
== 0; // { dg-warning "-Waddress" }
26 *p
++ = eifn_def
== 0; // { dg-warning "-Waddress" }
27 *p
++ = sifn
== 0; // { dg-warning "-Waddress" }
28 *p
++ = sifn_def
== 0; // { dg-warning "-Waddress" }
29 *p
++ = ifn
== 0; // { dg-warning "-Waddress" }
30 *p
++ = ifn_def
== 0; // { dg-warning "-Waddress" }
32 *p
++ = ewfn_def
== 0; // { dg-warning "-Waddress" }
34 *p
++ = wfn_def
== 0; // { dg-warning "-Waddress" }
39 int test_function_if (int i
)
41 if (eifn
) // { dg-warning "-Waddress" }
43 if (eifn_def
) // { dg-warning "-Waddress" }
45 if (sifn
) // { dg-warning "-Waddress" }
47 if (sifn_def
) // { dg-warning "-Waddress" }
49 if (ifn
) // { dg-warning "-Waddress" }
51 if (ifn_def
) // { dg-warning "-Waddress" }
55 if (ewfn_def
) // { dg-warning "-Waddress" }
59 if(wfn_def
) // { dg-warning "-Waddress" }
68 extern int ei_def
= 1;
71 static int si_def
= 1;
76 extern __attribute__ ((weak
)) int ewi
; // declaration (may be null)
77 extern __attribute__ ((weak
)) int ewi_def
= 1;
79 __attribute__ ((weak
)) int wi
; // definition (cannot be bull)
80 __attribute__ ((weak
)) int wi_def
= 1;
82 static __attribute__((weakref ("ewi"))) int swri
;
84 void test_scalar (int *p
)
86 *p
++ = &ei
== 0; // { dg-warning "-Waddress" }
87 *p
++ = &ei_def
== 0; // { dg-warning "-Waddress" }
88 *p
++ = &si
== 0; // { dg-warning "-Waddress" }
89 *p
++ = &si_def
== 0; // { dg-warning "-Waddress" }
90 *p
++ = &i
== 0; // { dg-warning "-Waddress" }
91 *p
++ = &i_def
== 0; // { dg-warning "-Waddress" }
93 *p
++ = &ewi_def
== 0; // { dg-warning "-Waddress" }
94 *p
++ = &wi
== 0; // { dg-warning "-Waddress" }
95 *p
++ = &wi_def
== 0; // { dg-warning "-Waddress" }
101 extern int eia_def
[] = { 1 };
104 static int sia_def
[1] = { 1 };
107 int ia_def
[] = { 1 };
109 extern __attribute__ ((weak
)) int ewia
[];
110 extern __attribute__ ((weak
)) int ewia_def
[] = { 1 };
112 __attribute__ ((weak
)) int wia
[1]; // definition (cannot be null)
113 __attribute__ ((weak
)) int wia_def
[] = { 1 };
115 static __attribute__((weakref ("ewia"))) int swria
[1];
117 void test_array (int *p
)
119 *p
++ = eia
== 0; // { dg-warning "-Waddress" }
120 *p
++ = eia_def
== 0; // { dg-warning "-Waddress" }
121 *p
++ = sia
== 0; // { dg-warning "-Waddress" }
122 *p
++ = sia_def
== 0; // { dg-warning "-Waddress" }
123 *p
++ = ia
== 0; // { dg-warning "-Waddress" }
124 *p
++ = ia_def
== 0; // { dg-warning "-Waddress" }
126 *p
++ = ewia_def
== 0; // { dg-warning "-Waddress" }
127 *p
++ = wia
== 0; // { dg-warning "-Waddress" }
128 *p
++ = wia_def
== 0; // { dg-warning "-Waddress" }
132 /* { dg-prune-output "never defined" }
133 { dg-prune-output "initialized and declared 'extern'" } */