Debian Codegraph @

gcc/testsuite/c-c++-common/Wsizeof-pointer-memaccess5.c

raw
1 /* PR c/117230 */
2 /* { dg-do compile } */
3 /* { dg-options "-Wsizeof-pointer-memaccess" } */
4
5 typedef int V __attribute__((vector_size (sizeof (int))));
6
7 void
8 foo (V *a, char *b)
9 {
10 __builtin_memcpy (b, a, sizeof (a)); /* { dg-warning "argument to 'sizeof' in '\[^\n\r]*__builtin_memcpy\[^\n\r]*' call is the same expression as the source; did you mean to dereference it\\\?" } */
11 }
12
13 void
14 bar (V *a, char *b)
15 {
16 __builtin_memcpy (a, b, sizeof (a)); /* { dg-warning "argument to 'sizeof' in '\[^\n\r]*__builtin_memcpy\[^\n\r]*' call is the same expression as the destination; did you mean to dereference it\\\?" } */
17 }
18
19 int
20 baz (V *a, char *b)
21 {
22 return __builtin_memcmp (a, b, sizeof (a)); /* { dg-warning "argument to 'sizeof' in '\[^\n\r]*__builtin_memcmp\[^\n\r]*' call is the same expression as the first source; did you mean to dereference it\\\?" } */
23 }
24
25 int
26 qux (V *a, char *b)
27 {
28 return __builtin_memcmp (b, a, sizeof (a)); /* { dg-warning "argument to 'sizeof' in '\[^\n\r]*__builtin_memcmp\[^\n\r]*' call is the same expression as the second source; did you mean to dereference it\\\?" } */
29 }