https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102462
--- Comment #3 from Hongtao.liu <crazylht at gmail dot com> ---
case3:
struct A1
{
char n;
char a[1]; // { dg-message "destination object" "note" }
};
void sink (void*);
struct A1 a1i_1 = { 0, { 1 } };
void ga1i_1 (void)
{
a1i_1.a[0] = 0;
a1i_1.a[1] = 1; // { dg-warning "\\\[-Wstringop-overflow" }
a1i_1.a[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" }
struct A1 a = { 0, { 1 } };
a.a[0] = 1;
a.a[1] = 2; // { dg-warning "\\\[-Wstringop-overflow" }
a.a[2] = 3; // { dg-warning "\\\[-Wstringop-overflow" }
sink (&a);
}
I think i was wrong, there's no case3, case3 is just case2, part of access
inbound, part is not, now the warning message is from struct A1 a = { 0, { 1 }
}; which is recorded as the vectorized stmt lineno
[case3.c:15:13] MEM <vector(4) char> [(char *)&a] = { 0, 1, 2, 3 };