1 /* Test -Wsizeof-pointer-memaccess warnings. */
2 /* { dg-do compile } */
3 /* { dg-options "-Wall" } */
5 typedef __SIZE_TYPE__ size_t;
6 extern void bzero (void *, size_t);
7 extern void bcopy (void *, const void *, size_t);
8 extern int bcmp (const void *, const void *, size_t);
10 struct A { short a, b; int c, d; long e, f; };
18 typedef int X[3][3][3];
23 struct A a, *pa1 = &a;
27 bzero (&a, sizeof (&a)); /* { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" } */
28 bzero (pa1, sizeof (pa1)); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
29 bzero (pa2, sizeof pa2); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
30 bzero (pa3, sizeof (pa3)); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
31 bzero (pa4, sizeof pa4); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
32 bzero (pa1, sizeof (struct A *)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
33 bzero (pa2, sizeof (PTA)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
34 bzero (pa3, sizeof (PA)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
35 bzero (pa4, sizeof (__typeof (pa4))); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
37 bcopy (x, &a, sizeof (&a)); /* { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" } */
38 bcopy (x, pa1, sizeof (pa1)); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
39 bcopy (x, pa2, sizeof pa2); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
40 bcopy (x, pa3, sizeof (pa3)); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
41 bcopy (x, pa4, sizeof pa4); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
42 bcopy (x, pa1, sizeof (struct A *)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
43 bcopy (x, pa2, sizeof (PTA)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
44 bcopy (x, pa3, sizeof (PA)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
45 bcopy (x, pa4, sizeof (__typeof (pa4))); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
47 bcopy (&a, x, sizeof (&a)); /* { dg-warning "call is the same expression as the source; did you mean to remove the addressof" } */
48 bcopy (pa1, x, sizeof (pa1)); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
49 bcopy (pa2, x, sizeof pa2); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
50 bcopy (pa3, x, sizeof (pa3)); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
51 bcopy (pa4, x, sizeof pa4); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
52 bcopy (pa1, x, sizeof (struct A *)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
53 bcopy (pa2, x, sizeof (PTA)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
54 bcopy (pa3, x, sizeof (PA)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
55 bcopy (pa4, x, sizeof (__typeof (pa4))); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
57 z += bcmp (&a, x, sizeof (&a)); /* { dg-warning "call is the same expression as the first source; did you mean to remove the addressof" } */
58 z += bcmp (pa1, x, sizeof (pa1)); /* { dg-warning "call is the same expression as the first source; did you mean to dereference it" } */
59 z += bcmp (pa2, x, sizeof pa2); /* { dg-warning "call is the same expression as the first source; did you mean to dereference it" } */
60 z += bcmp (pa3, x, sizeof (pa3)); /* { dg-warning "call is the same expression as the first source; did you mean to dereference it" } */
61 z += bcmp (pa4, x, sizeof pa4); /* { dg-warning "call is the same expression as the first source; did you mean to dereference it" } */
62 z += bcmp (pa1, x, sizeof (struct A *)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the first source; expected \[^\n\r\]* or an explicit length" } */
63 z += bcmp (pa2, x, sizeof (PTA)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the first source; expected \[^\n\r\]* or an explicit length" } */
64 z += bcmp (pa3, x, sizeof (PA)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the first source; expected \[^\n\r\]* or an explicit length" } */
66 z += bcmp (x, &a, sizeof (&a)); /* { dg-warning "call is the same expression as the second source; did you mean to remove the addressof" } */
67 z += bcmp (x, pa1, sizeof (pa1)); /* { dg-warning "call is the same expression as the second source; did you mean to dereference it" } */
68 z += bcmp (x, pa2, sizeof pa2); /* { dg-warning "call is the same expression as the second source; did you mean to dereference it" } */
69 z += bcmp (x, pa3, sizeof (pa3)); /* { dg-warning "call is the same expression as the second source; did you mean to dereference it" } */
70 z += bcmp (x, pa4, sizeof pa4); /* { dg-warning "call is the same expression as the second source; did you mean to dereference it" } */
71 z += bcmp (x, pa1, sizeof (struct A *)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the second source; expected \[^\n\r\]* or an explicit length" } */
72 z += bcmp (x, pa2, sizeof (PTA)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the second source; expected \[^\n\r\]* or an explicit length" } */
73 z += bcmp (x, pa3, sizeof (PA)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the second source; expected \[^\n\r\]* or an explicit length" } */
75 /* These are correct, no warning. */
77 bzero (&a, sizeof (a));
78 bzero (&a, sizeof (struct A));
79 bzero (&a, sizeof (const struct A));
80 bzero (&a, sizeof (volatile struct A));
81 bzero (&a, sizeof (volatile const struct A));
82 bzero (&a, sizeof (TA));
83 bzero (&a, sizeof (__typeof (*&a)));
84 bzero (pa1, sizeof (*pa1));
85 bzero (pa2, sizeof (*pa3));
86 bzero (pa3, sizeof (__typeof (*pa3)));
87 /* These are probably broken, but obfuscated, no warning. */
88 bzero ((void *) &a, sizeof (&a));
89 bzero ((char *) &a, sizeof (&a));
90 bzero (&a, sizeof (&a) + 0);
91 bzero (&a, 0 + sizeof (&a));
93 /* These are correct, no warning. */
94 bcopy (x, &a, sizeof a);
95 bcopy (x, &a, sizeof (a));
96 bcopy (x, &a, sizeof (struct A));
97 bcopy (x, &a, sizeof (const struct A));
98 bcopy (x, &a, sizeof (volatile struct A));
99 bcopy (x, &a, sizeof (volatile const struct A));
100 bcopy (x, &a, sizeof (TA));
101 bcopy (x, &a, sizeof (__typeof (*&a)));
102 bcopy (x, pa1, sizeof (*pa1));
103 bcopy (x, pa2, sizeof (*pa3));
104 bcopy (x, pa3, sizeof (__typeof (*pa3)));
105 /* These are probably broken, but obfuscated, no warning. */
106 bcopy (x, (void *) &a, sizeof (&a));
107 bcopy (x, (char *) &a, sizeof (&a));
108 bcopy (x, &a, sizeof (&a) + 0);
109 bcopy (x, &a, 0 + sizeof (&a));
111 /* These are correct, no warning. */
112 bcopy (&a, x, sizeof a);
113 bcopy (&a, x, sizeof (a));
114 bcopy (&a, x, sizeof (struct A));
115 bcopy (&a, x, sizeof (const struct A));
116 bcopy (&a, x, sizeof (volatile struct A));
117 bcopy (&a, x, sizeof (volatile const struct A));
118 bcopy (&a, x, sizeof (TA));
119 bcopy (&a, x, sizeof (__typeof (*&a)));
120 bcopy (pa1, x, sizeof (*pa1));
121 bcopy (pa2, x, sizeof (*pa3));
122 bcopy (pa3, x, sizeof (__typeof (*pa3)));
123 /* These are probably broken, but obfuscated, no warning. */
124 bcopy ((void *) &a, x, sizeof (&a));
125 bcopy ((char *) &a, x, sizeof (&a));
126 bcopy (&a, x, sizeof (&a) + 0);
127 bcopy (&a, x, 0 + sizeof (&a));
129 /* These are correct, no warning. */
130 z += bcmp (&a, x, sizeof a);
131 z += bcmp (&a, x, sizeof (a));
132 z += bcmp (&a, x, sizeof (struct A));
133 z += bcmp (&a, x, sizeof (const struct A));
134 z += bcmp (&a, x, sizeof (volatile struct A));
135 z += bcmp (&a, x, sizeof (volatile const struct A));
136 z += bcmp (&a, x, sizeof (TA));
137 z += bcmp (&a, x, sizeof (__typeof (*&a)));
138 z += bcmp (pa1, x, sizeof (*pa1));
139 z += bcmp (pa2, x, sizeof (*pa3));
140 z += bcmp (pa3, x, sizeof (__typeof (*pa3)));
141 /* These are probably broken, but obfuscated, no warning. */
142 z += bcmp ((void *) &a, x, sizeof (&a));
143 z += bcmp ((char *) &a, x, sizeof (&a));
144 z += bcmp (&a, x, sizeof (&a) + 0);
145 z += bcmp (&a, x, 0 + sizeof (&a));
147 /* These are correct, no warning. */
148 z += bcmp (x, &a, sizeof a);
149 z += bcmp (x, &a, sizeof (a));
150 z += bcmp (x, &a, sizeof (struct A));
151 z += bcmp (x, &a, sizeof (const struct A));
152 z += bcmp (x, &a, sizeof (volatile struct A));
153 z += bcmp (x, &a, sizeof (volatile const struct A));
154 z += bcmp (x, &a, sizeof (TA));
155 z += bcmp (x, &a, sizeof (__typeof (*&a)));
156 z += bcmp (x, pa1, sizeof (*pa1));
157 z += bcmp (x, pa2, sizeof (*pa3));
158 z += bcmp (x, pa3, sizeof (__typeof (*pa3)));
159 /* These are probably broken, but obfuscated, no warning. */
160 z += bcmp (x, (void *) &a, sizeof (&a));
161 z += bcmp (x, (char *) &a, sizeof (&a));
162 z += bcmp (x, &a, sizeof (&a) + 0);
163 z += bcmp (x, &a, 0 + sizeof (&a));
171 struct B b, *pb1 = &b;
175 bzero (&b, sizeof (&b)); /* { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" } */
176 bzero (pb1, sizeof (pb1)); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
177 bzero (pb2, sizeof pb2); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
178 bzero (pb3, sizeof (pb3)); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
179 bzero (pb4, sizeof pb4); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
180 bzero (pb1, sizeof (struct B *)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
181 bzero (pb2, sizeof (PTB)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
182 bzero (pb3, sizeof (PB)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
183 bzero (pb4, sizeof (__typeof (pb4))); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
185 bcopy (x, &b, sizeof (&b)); /* { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" } */
186 bcopy (x, pb1, sizeof (pb1)); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
187 bcopy (x, pb2, sizeof pb2); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
188 bcopy (x, pb3, sizeof (pb3)); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
189 bcopy (x, pb4, sizeof pb4); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
190 bcopy (x, pb1, sizeof (struct B *)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
191 bcopy (x, pb2, sizeof (PTB)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
192 bcopy (x, pb3, sizeof (PB)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
193 bcopy (x, pb4, sizeof (__typeof (pb4))); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
195 bcopy (&b, x, sizeof (&b)); /* { dg-warning "call is the same expression as the source; did you mean to remove the addressof" } */
196 bcopy (pb1, x, sizeof (pb1)); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
197 bcopy (pb2, x, sizeof pb2); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
198 bcopy (pb3, x, sizeof (pb3)); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
199 bcopy (pb4, x, sizeof pb4); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
200 bcopy (pb1, x, sizeof (struct B *)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
201 bcopy (pb2, x, sizeof (PTB)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
202 bcopy (pb3, x, sizeof (PB)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
203 bcopy (pb4, x, sizeof (__typeof (pb4))); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
205 z += bcmp (&b, x, sizeof (&b)); /* { dg-warning "call is the same expression as the first source; did you mean to remove the addressof" } */
206 z += bcmp (pb1, x, sizeof (pb1)); /* { dg-warning "call is the same expression as the first source; did you mean to dereference it" } */
207 z += bcmp (pb2, x, sizeof pb2); /* { dg-warning "call is the same expression as the first source; did you mean to dereference it" } */
208 z += bcmp (pb3, x, sizeof (pb3)); /* { dg-warning "call is the same expression as the first source; did you mean to dereference it" } */
209 z += bcmp (pb4, x, sizeof pb4); /* { dg-warning "call is the same expression as the first source; did you mean to dereference it" } */
210 z += bcmp (pb1, x, sizeof (struct B *)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the first source; expected \[^\n\r\]* or an explicit length" } */
211 z += bcmp (pb2, x, sizeof (PTB)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the first source; expected \[^\n\r\]* or an explicit length" } */
212 z += bcmp (pb3, x, sizeof (PB)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the first source; expected \[^\n\r\]* or an explicit length" } */
214 z += bcmp (x, &b, sizeof (&b)); /* { dg-warning "call is the same expression as the second source; did you mean to remove the addressof" } */
215 z += bcmp (x, pb1, sizeof (pb1)); /* { dg-warning "call is the same expression as the second source; did you mean to dereference it" } */
216 z += bcmp (x, pb2, sizeof pb2); /* { dg-warning "call is the same expression as the second source; did you mean to dereference it" } */
217 z += bcmp (x, pb3, sizeof (pb3)); /* { dg-warning "call is the same expression as the second source; did you mean to dereference it" } */
218 z += bcmp (x, pb4, sizeof pb4); /* { dg-warning "call is the same expression as the second source; did you mean to dereference it" } */
219 z += bcmp (x, pb1, sizeof (struct B *)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the second source; expected \[^\n\r\]* or an explicit length" } */
220 z += bcmp (x, pb2, sizeof (PTB)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the second source; expected \[^\n\r\]* or an explicit length" } */
221 z += bcmp (x, pb3, sizeof (PB)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the second source; expected \[^\n\r\]* or an explicit length" } */
223 /* These are correct, no warning. */
224 bzero (&b, sizeof b);
225 bzero (&b, sizeof (b));
226 bzero (&b, sizeof (struct B));
227 bzero (&b, sizeof (const struct B));
228 bzero (&b, sizeof (volatile struct B));
229 bzero (&b, sizeof (volatile const struct B));
230 bzero (&b, sizeof (TB));
231 bzero (&b, sizeof (__typeof (*&b)));
232 bzero (pb1, sizeof (*pb1));
233 bzero (pb2, sizeof (*pb3));
234 bzero (pb3, sizeof (__typeof (*pb3)));
235 /* These are probably broken, but obfuscated, no warning. */
236 bzero ((void *) &b, sizeof (&b));
237 bzero ((char *) &b, sizeof (&b));
238 bzero (&b, sizeof (&b) + 0);
239 bzero (&b, 0 + sizeof (&b));
241 /* These are correct, no warning. */
242 bcopy (x, &b, sizeof b);
243 bcopy (x, &b, sizeof (b));
244 bcopy (x, &b, sizeof (struct B));
245 bcopy (x, &b, sizeof (const struct B));
246 bcopy (x, &b, sizeof (volatile struct B));
247 bcopy (x, &b, sizeof (volatile const struct B));
248 bcopy (x, &b, sizeof (TB));
249 bcopy (x, &b, sizeof (__typeof (*&b)));
250 bcopy (x, pb1, sizeof (*pb1));
251 bcopy (x, pb2, sizeof (*pb3));
252 bcopy (x, pb3, sizeof (__typeof (*pb3)));
253 /* These are probably broken, but obfuscated, no warning. */
254 bcopy (x, (void *) &b, sizeof (&b));
255 bcopy (x, (char *) &b, sizeof (&b));
256 bcopy (x, &b, sizeof (&b) + 0);
257 bcopy (x, &b, 0 + sizeof (&b));
259 /* These are correct, no warning. */
260 bcopy (&b, x, sizeof b);
261 bcopy (&b, x, sizeof (b));
262 bcopy (&b, x, sizeof (struct B));
263 bcopy (&b, x, sizeof (const struct B));
264 bcopy (&b, x, sizeof (volatile struct B));
265 bcopy (&b, x, sizeof (volatile const struct B));
266 bcopy (&b, x, sizeof (TB));
267 bcopy (&b, x, sizeof (__typeof (*&b)));
268 bcopy (pb1, x, sizeof (*pb1));
269 bcopy (pb2, x, sizeof (*pb3));
270 bcopy (pb3, x, sizeof (__typeof (*pb3)));
271 /* These are probably broken, but obfuscated, no warning. */
272 bcopy ((void *) &b, x, sizeof (&b));
273 bcopy ((char *) &b, x, sizeof (&b));
274 bcopy (&b, x, sizeof (&b) + 0);
275 bcopy (&b, x, 0 + sizeof (&b));
277 /* These are correct, no warning. */
278 z += bcmp (&b, x, sizeof b);
279 z += bcmp (&b, x, sizeof (b));
280 z += bcmp (&b, x, sizeof (struct B));
281 z += bcmp (&b, x, sizeof (const struct B));
282 z += bcmp (&b, x, sizeof (volatile struct B));
283 z += bcmp (&b, x, sizeof (volatile const struct B));
284 z += bcmp (&b, x, sizeof (TB));
285 z += bcmp (&b, x, sizeof (__typeof (*&b)));
286 z += bcmp (pb1, x, sizeof (*pb1));
287 z += bcmp (pb2, x, sizeof (*pb3));
288 z += bcmp (pb3, x, sizeof (__typeof (*pb3)));
289 /* These are probably broken, but obfuscated, no warning. */
290 z += bcmp ((void *) &b, x, sizeof (&b));
291 z += bcmp ((char *) &b, x, sizeof (&b));
292 z += bcmp (&b, x, sizeof (&b) + 0);
293 z += bcmp (&b, x, 0 + sizeof (&b));
295 /* These are correct, no warning. */
296 z += bcmp (x, &b, sizeof b);
297 z += bcmp (x, &b, sizeof (b));
298 z += bcmp (x, &b, sizeof (struct B));
299 z += bcmp (x, &b, sizeof (const struct B));
300 z += bcmp (x, &b, sizeof (volatile struct B));
301 z += bcmp (x, &b, sizeof (volatile const struct B));
302 z += bcmp (x, &b, sizeof (TB));
303 z += bcmp (x, &b, sizeof (__typeof (*&b)));
304 z += bcmp (x, pb1, sizeof (*pb1));
305 z += bcmp (x, pb2, sizeof (*pb3));
306 z += bcmp (x, pb3, sizeof (__typeof (*pb3)));
307 /* These are probably broken, but obfuscated, no warning. */
308 z += bcmp (x, (void *) &b, sizeof (&b));
309 z += bcmp (x, (char *) &b, sizeof (&b));
310 z += bcmp (x, &b, sizeof (&b) + 0);
311 z += bcmp (x, &b, 0 + sizeof (&b));
317 f3 (void *x, char *y, int z, X w)
319 unsigned char *y1 = (unsigned char *) __builtin_alloca (z + 16);
321 signed char buf2[z + 32];
324 signed char *y2 = buf2;
327 bzero (y, sizeof (y)); /* { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" } */
328 bzero (y1, sizeof (y1)); /* { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" } */
329 bzero (y2, sizeof (y2)); /* { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" } */
330 bzero (&c, sizeof (&c)); /* { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" } */
331 bzero (w, sizeof w); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
333 bcopy (x, y, sizeof (y)); /* { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" } */
334 bcopy (x, y1, sizeof (y1)); /* { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" } */
335 bcopy (x, y2, sizeof (y2)); /* { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" } */
336 bcopy (x, &c, sizeof (&c)); /* { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" } */
337 bcopy (x, w, sizeof w); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
339 bcopy (y, x, sizeof (y)); /* { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" } */
340 bcopy (y1, x, sizeof (y1)); /* { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" } */
341 bcopy (y2, x, sizeof (y2)); /* { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" } */
342 bcopy (&c, x, sizeof (&c)); /* { dg-warning "call is the same expression as the source; did you mean to remove the addressof" } */
343 bcopy (w, x, sizeof w); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
345 z += bcmp (y, x, sizeof (y)); /* { dg-warning "call is the same expression as the first source; did you mean to provide an explicit length" } */
346 z += bcmp (y1, x, sizeof (y1)); /* { dg-warning "call is the same expression as the first source; did you mean to provide an explicit length" } */
347 z += bcmp (y2, x, sizeof (y2)); /* { dg-warning "call is the same expression as the first source; did you mean to provide an explicit length" } */
348 z += bcmp (&c, x, sizeof (&c)); /* { dg-warning "call is the same expression as the first source; did you mean to remove the addressof" } */
349 z += bcmp (w, x, sizeof w); /* { dg-warning "call is the same expression as the first source; did you mean to dereference it" } */
351 z += bcmp (x, y, sizeof (y)); /* { dg-warning "call is the same expression as the second source; did you mean to provide an explicit length" } */
352 z += bcmp (x, y1, sizeof (y1)); /* { dg-warning "call is the same expression as the second source; did you mean to provide an explicit length" } */
353 z += bcmp (x, y2, sizeof (y2)); /* { dg-warning "call is the same expression as the second source; did you mean to provide an explicit length" } */
354 z += bcmp (x, &c, sizeof (&c)); /* { dg-warning "call is the same expression as the second source; did you mean to remove the addressof" } */
355 z += bcmp (x, w, sizeof w); /* { dg-warning "call is the same expression as the second source; did you mean to dereference it" } */
357 /* These are correct, no warning. */
358 bzero (y, sizeof (*y));
359 bzero (y1, sizeof (*y2));
360 bzero (buf1, sizeof buf1);
361 bzero (buf3, sizeof (buf3));
362 bzero (&buf3[0], sizeof (buf3));
363 bzero (&buf4[0], sizeof (buf4));
364 bzero (w, sizeof (X));
365 /* These are probably broken, but obfuscated, no warning. */
366 bzero ((void *) y, sizeof (y));
367 bzero ((char *) y1, sizeof (y2));
368 bzero (y, sizeof (y) + 0);
369 bzero (y1, 0 + sizeof (y2));
370 bzero ((void *) &c, sizeof (&c));
371 bzero ((signed char *) &c, sizeof (&c));
372 bzero (&c, sizeof (&c) + 0);
373 bzero (&c, 0 + sizeof (&c));
375 /* These are correct, no warning. */
376 bcopy (x, y, sizeof (*y));
377 bcopy (x, y1, sizeof (*y2));
378 bcopy (x, buf1, sizeof buf1);
379 bcopy (x, buf3, sizeof (buf3));
380 bcopy (x, &buf3[0], sizeof (buf3));
381 bcopy (x, &buf4[0], sizeof (buf4));
382 bcopy (y, &y3, sizeof (y3));
383 bcopy (y, (char *) &y3, sizeof (y3));
384 bcopy (x, w, sizeof (X));
385 /* These are probably broken, but obfuscated, no warning. */
386 bcopy (x, (void *) y, sizeof (y));
387 bcopy (x, (char *) y1, sizeof (y2));
388 bcopy (x, y, sizeof (y) + 0);
389 bcopy (x, y1, 0 + sizeof (y2));
390 bcopy (x, (void *) &c, sizeof (&c));
391 bcopy (x, (signed char *) &c, sizeof (&c));
392 bcopy (x, &c, sizeof (&c) + 0);
393 bcopy (x, &c, 0 + sizeof (&c));
395 /* These are correct, no warning. */
396 bcopy (y, x, sizeof (*y));
397 bcopy (y1, x, sizeof (*y2));
398 bcopy (buf1, x, sizeof buf1);
399 bcopy (buf3, x, sizeof (buf3));
400 bcopy (&buf3[0], x, sizeof (buf3));
401 bcopy (&buf4[0], x, sizeof (buf4));
402 bcopy (&y3, y, sizeof (y3));
403 bcopy ((char *) &y3, y, sizeof (y3));
404 bcopy (w, x, sizeof (X));
405 /* These are probably broken, but obfuscated, no warning. */
406 bcopy ((void *) y, x, sizeof (y));
407 bcopy ((char *) y1, x, sizeof (y2));
408 bcopy (y, x, sizeof (y) + 0);
409 bcopy (y1, x, 0 + sizeof (y2));
410 bcopy ((void *) &c, x, sizeof (&c));
411 bcopy ((signed char *) &c, x, sizeof (&c));
412 bcopy (&c, x, sizeof (&c) + 0);
413 bcopy (&c, x, 0 + sizeof (&c));
415 /* These are correct, no warning. */
416 z += bcmp (y, x, sizeof (*y));
417 z += bcmp (y1, x, sizeof (*y2));
418 z += bcmp (buf1, x, sizeof buf1);
419 z += bcmp (buf3, x, sizeof (buf3));
420 z += bcmp (&buf3[0], x, sizeof (buf3));
421 z += bcmp (&buf4[0], x, sizeof (buf4));
422 z += bcmp (&y3, y, sizeof (y3));
423 z += bcmp ((char *) &y3, y, sizeof (y3));
424 z += bcmp (w, x, sizeof (X));
425 /* These are probably broken, but obfuscated, no warning. */
426 z += bcmp ((void *) y, x, sizeof (y));
427 z += bcmp ((char *) y1, x, sizeof (y2));
428 z += bcmp (y, x, sizeof (y) + 0);
429 z += bcmp (y1, x, 0 + sizeof (y2));
430 z += bcmp ((void *) &c, x, sizeof (&c));
431 z += bcmp ((signed char *) &c, x, sizeof (&c));
432 z += bcmp (&c, x, sizeof (&c) + 0);
433 z += bcmp (&c, x, 0 + sizeof (&c));
435 /* These are correct, no warning. */
436 z += bcmp (x, y, sizeof (*y));
437 z += bcmp (x, y1, sizeof (*y2));
438 z += bcmp (x, buf1, sizeof buf1);
439 z += bcmp (x, buf3, sizeof (buf3));
440 z += bcmp (x, &buf3[0], sizeof (buf3));
441 z += bcmp (x, &buf4[0], sizeof (buf4));
442 z += bcmp (y, &y3, sizeof (y3));
443 z += bcmp (y, (char *) &y3, sizeof (y3));
444 z += bcmp (x, w, sizeof (X));
445 /* These are probably broken, but obfuscated, no warning. */
446 z += bcmp (x, (void *) y, sizeof (y));
447 z += bcmp (x, (char *) y1, sizeof (y2));
448 z += bcmp (x, y, sizeof (y) + 0);
449 z += bcmp (x, y1, 0 + sizeof (y2));
450 z += bcmp (x, (void *) &c, sizeof (&c));
451 z += bcmp (x, (signed char *) &c, sizeof (&c));
452 z += bcmp (x, &c, sizeof (&c) + 0);
453 z += bcmp (x, &c, 0 + sizeof (&c));