]>
Commit | Line | Data |
---|---|---|
28a5fa54 | 1 | /* Test to verify that -Wstringop-overflow mentions the referenced object |
28a5fa54 MS |
2 | { dg-do compile } |
3 | { dg-options "-O2 -Wall" } */ | |
4 | ||
5 | static void copy_n (char *d, const char *s, int n) | |
6 | { | |
7 | while (n--) | |
8817bd75 | 8 | *d++ = *s++; |
28a5fa54 MS |
9 | *d = 0; // { dg-warning "writing 1 byte into a region of size 0" } |
10 | } | |
11 | ||
12 | void sink (void*); | |
13 | ||
14 | void call_copy_n (const char *s) | |
15 | { | |
eafe8ee7 | 16 | char a[7]; // { dg-message "at offset 7 into destination object 'a'" } |
28a5fa54 MS |
17 | copy_n (a, "1234567", 7); |
18 | sink (a); | |
19 | } |