https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102722
Bug ID: 102722
Summary: [Disgnostic]Xpass for gcc.dg/Wstringop-overflow-68.c
after O2 vectorization.
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: crazylht at gmail dot com
Target Milestone: ---
Host: x86_64-pc-linux-gnu
void warn_comp_lit (void)
{
*(AC2*)a1 = Ac2; // { dg-warning "writing 2 bytes into a region of size
1" "pr101475" { xfail *-*-* } }
// and warning should be expected, refer to PR102697.
*(AC4*)a2 = Ac4; // { dg-warning "writing 4 bytes into a region of size
2" "pr101475" { xfail { ! { i?86-*-* x86_64-*-* } } } }
*(AC4*)a3 = Ac4; // { dg-warning "writing 4 bytes into a region of size
3" "pr101475" { xfail { ! { i?86-*-* x86_64-*-* } } } }
*(AC8*)a4 = Ac8; // { dg-warning "writing 8 bytes into a region of size
4" "pr101475" { xfail { ! { i?86-*-* x86_64-*-* } } } }
*(AC8*)a7 = Ac8; // { dg-warning "writing 8 bytes into a region of size
7" "pr101475" { xfail { ! { i?86-*-* x86_64-*-* } } } }
*(AC16*)a15 = Ac16; // { dg-warning "writing 16 bytes into a region of size
15" "pr101475" { xfail { ! { i?86-*-* x86_64-*-* } } } }
}
The xpass here looks exact what we want,After vectorization, it's optimized to
// MEM <vector(4) char> [(char *)&a2] = { 0, 1, 2, 3 };
// MEM <vector(4) char> [(char *)&a3] = { 0, 1, 2, 3 };
// MEM <vector(8) char> [(char *)&a4] = { 0, 1, 2, 3, 4, 5, 6, 7 };
// MEM <vector(8) char> [(char *)&a7] = { 0, 1, 2, 3, 4, 5, 6, 7 };
// MEM <vector(16) char> [(char *)&a15] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15 };
and Wstring-overflow catchs these.